def createAccount(firstName, lastName, emailAddress, username, password): account = Account() account.IsAdmin = False account.FirstName = firstName account.LastName = lastName account.EmailAddress = emailAddress account.RoleId = 1 account.CreationDate = datetime.datetime.now() account.LastLogin = datetime.datetime.now() account.Username = username account.Password = password db.session.add(account) db.session.commit()
SQLALCHEMY_TRACK_MODIFICATIONS=model.track_modification) model.init_app(app) # help(model) acc = Account() acc.IsAdmin = False acc.FirstName = 'Erik' acc.LastName = 'Stevens' acc.EmailAddress = '*****@*****.**' # pas un vrai ... malheureusement acc.RoleId = 1 acc.CreationDate = datetime.datetime.now() acc.LastLogin = datetime.datetime.now() acc.Username = '******' acc.Password = '******' model.db.session.add(acc) acc = Account() acc.IsAdmin = False acc.FirstName = 'a' acc.LastName = 'a' acc.EmailAddress = '[email protected]' # pas un vrai ... malheureusement acc.RoleId = 1 acc.CreationDate = datetime.datetime.now() acc.LastLogin = datetime.datetime.now() acc.Username = '******' acc.Password = '******' model.db.session.add(acc) acc = Account()