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
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
def init_model(engine): """Call me before using any of the tables or classes in the model""" Session.configure(bind=engine)