示例#1
0
 def create(cls, email, password, **kwargs):
     user = cls()
     user.email = email
     user.password = bcrypt.hashpw(password, bcrypt.gensalt())
     user.__dict__.update(kwargs)
     Session.add(user)
     Session.commit()
     return user
示例#2
0
 def create_google(cls, email, uid, token, **kwargs):
     user = cls()
     user.email = email
     user.googe_id = uid
     user.google_token = token
     user.__dict__.update(kwargs)
     Session.add(user)
     Session.commit()
     return user
示例#3
0
def init_model(engine):
    """Call me before using any of the tables or classes in the model"""
    Session.configure(bind=engine)