Merge branch 'master' of github.com:kvesteri/sqlalchemy-utils
This commit is contained in:
@@ -63,6 +63,14 @@ CurrencyType
|
|||||||
.. autoclass:: Currency
|
.. autoclass:: Currency
|
||||||
|
|
||||||
|
|
||||||
|
EmailType
|
||||||
|
---------
|
||||||
|
|
||||||
|
.. automodule:: sqlalchemy_utils.types.email
|
||||||
|
|
||||||
|
.. autoclass:: EmailType
|
||||||
|
|
||||||
|
|
||||||
EncryptedType
|
EncryptedType
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
@@ -152,7 +152,7 @@ Category has many Products.
|
|||||||
Observing multiple columns
|
Observing multiple columns
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
You can also observe multiple columns by spesifying all the observable columns
|
You can also observe multiple columns by specifying all the observable columns
|
||||||
in the decorator.
|
in the decorator.
|
||||||
|
|
||||||
|
|
||||||
|
@@ -4,6 +4,33 @@ from ..operators import CaseInsensitiveComparator
|
|||||||
|
|
||||||
|
|
||||||
class EmailType(sa.types.TypeDecorator):
|
class EmailType(sa.types.TypeDecorator):
|
||||||
|
"""
|
||||||
|
Provides a way for storing emails in a lower case.
|
||||||
|
|
||||||
|
Example::
|
||||||
|
|
||||||
|
|
||||||
|
from sqlalchemy_utils import EmailType
|
||||||
|
|
||||||
|
|
||||||
|
class User(Base):
|
||||||
|
__tablename__ = 'user'
|
||||||
|
id = sa.Column(sa.Integer, primary_key=True)
|
||||||
|
name = sa.Column(sa.Unicode(255))
|
||||||
|
email = sa.Column(EmailType)
|
||||||
|
|
||||||
|
|
||||||
|
user = User()
|
||||||
|
user.email = 'John.Smith@foo.com'
|
||||||
|
user.name = 'John Smith'
|
||||||
|
session.add(user)
|
||||||
|
session.commit()
|
||||||
|
# Notice - email in filter() is lowercase.
|
||||||
|
user = (session.query(User)
|
||||||
|
.filter(User.email == 'john.smith@foo.com')
|
||||||
|
.one())
|
||||||
|
assert user.name == 'John Smith'
|
||||||
|
"""
|
||||||
impl = sa.Unicode
|
impl = sa.Unicode
|
||||||
comparator_factory = CaseInsensitiveComparator
|
comparator_factory = CaseInsensitiveComparator
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user