Created
May 18, 2015 10:29
-
-
Save theho/d2f10cdeb050f6dbee82 to your computer and use it in GitHub Desktop.
satellizer User model using @hydbrid_property
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original file https://github.com/jimmyho/satellizer/blob/master/examples/server/python/app.py | |
from sqlalchemy.ext.hybrid import hybrid_property | |
class User(db.Model): | |
_password = db.Column('password', db.String(120)) | |
# ... etc ... | |
@hybrid_property | |
def password(self): | |
return self._password | |
@password.setter | |
def password(self, password): | |
self._password = generate_password_hash(password) | |
def __init__(self, email=None, password=None, display_name=None, facebook=None,\ | |
github=None, google=None, linkedin=None, twitter=None): | |
if email: | |
self.email = email.lower() | |
if password: | |
self.password = password | |
# ... etc ... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment