Skip to content

Instantly share code, notes, and snippets.

@theho
Created May 18, 2015 10:29
Show Gist options
  • Save theho/d2f10cdeb050f6dbee82 to your computer and use it in GitHub Desktop.
Save theho/d2f10cdeb050f6dbee82 to your computer and use it in GitHub Desktop.
satellizer User model using @hydbrid_property
# 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