Added docs for URLType
This commit is contained in:
@@ -94,7 +94,7 @@ You can easily set up integer lists too:
|
|||||||
ColorType
|
ColorType
|
||||||
---------
|
---------
|
||||||
|
|
||||||
ColorType provides a way for saving Color (from colour package) objects into database.
|
ColorType provides a way for saving Color (from colour_ package) objects into database.
|
||||||
ColorType saves Color objects as strings on the way in and converts them back to objects when querying the database.
|
ColorType saves Color objects as strings on the way in and converts them back to objects when querying the database.
|
||||||
|
|
||||||
::
|
::
|
||||||
@@ -173,6 +173,35 @@ NumberRange supports some arithmetic operators:
|
|||||||
# '30-140'
|
# '30-140'
|
||||||
|
|
||||||
|
|
||||||
|
URLType
|
||||||
|
-------
|
||||||
|
|
||||||
|
URLType stores furl_ objects into database.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
from sqlalchemy_utils import URLType
|
||||||
|
from furl import furl
|
||||||
|
|
||||||
|
|
||||||
|
class User(Base):
|
||||||
|
__tablename__ = 'user'
|
||||||
|
|
||||||
|
id = sa.Column(sa.Integer, primary_key=True)
|
||||||
|
website = sa.Column(URLType)
|
||||||
|
|
||||||
|
|
||||||
|
user = User(website=u'www.example.com')
|
||||||
|
|
||||||
|
# website is coerced to furl object, hence all nice furl operations come
|
||||||
|
# available
|
||||||
|
user.website.args['some_argument'] = '12'
|
||||||
|
|
||||||
|
print user.website
|
||||||
|
# www.example.com?some_argument=12
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
UUIDType
|
UUIDType
|
||||||
--------
|
--------
|
||||||
|
|
||||||
@@ -259,6 +288,11 @@ Generic relationship is a form of relationship that supports creating a 1 to man
|
|||||||
session.query(Event).filter(Event.object.is_type(User)).all()
|
session.query(Event).filter(Event.object.is_type(User)).all()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.. _furl: https://github.com/gruns/furl
|
||||||
|
.. _colour: https://github.com/vaab/colour
|
||||||
|
|
||||||
|
|
||||||
API Documentation
|
API Documentation
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
@@ -16,6 +16,7 @@ from .phone_number import PhoneNumber, PhoneNumberType
|
|||||||
from .scalar_list import ScalarListException, ScalarListType
|
from .scalar_list import ScalarListException, ScalarListType
|
||||||
from .timezone import TimezoneType
|
from .timezone import TimezoneType
|
||||||
from .ts_vector import TSVectorType
|
from .ts_vector import TSVectorType
|
||||||
|
from .url import URLType
|
||||||
from .uuid import UUIDType
|
from .uuid import UUIDType
|
||||||
from .weekdays import WeekDay, WeekDays, WeekDaysType
|
from .weekdays import WeekDay, WeekDays, WeekDaysType
|
||||||
|
|
||||||
@@ -39,6 +40,7 @@ __all__ = (
|
|||||||
ScalarListType,
|
ScalarListType,
|
||||||
TimezoneType,
|
TimezoneType,
|
||||||
TSVectorType,
|
TSVectorType,
|
||||||
|
URLType,
|
||||||
UUIDType,
|
UUIDType,
|
||||||
WeekDay,
|
WeekDay,
|
||||||
WeekDays,
|
WeekDays,
|
||||||
|
Reference in New Issue
Block a user