def create_user(): username = request.form['username'] password = request.form['password'] email = request.form['email'] first_name = request.form['first_name'] last_name = request.form['last_name'] status = 'Offline' user = entities.User(first_name=first_name, last_name=last_name, username=username, password=password, email=email, status=status) db_session = db.getSession(engine) #usernames = db_session.query(entities.User).filter(entities.User.username == username) #emails = db_session.query(entities.User).filter(entities.User.email == email) #if usernames or emails: # return Response(json.dumps([len(username), len(emails)], cls=connector.AlchemyEncoder), mimetype="application/json") db_session.add(user) db_session.commit() if username and password: return redirect('/')
def create_test_users(): db_session = db.getSession(engine) user = entities.User(name="David", fullname="Lazo", password="******", username="******") db_session.add(user) db_session.commit() return "Test user created!"
def setup_users(): user = entities.User(username=username, name=name, fullname=fullname, password=password) session = db.getSession(engine) session.add(user) session.commit() return 'Create User'
def create_user(): c = json.loads(request.form['values']) user = entities.User(username=c['username'], name=c['name'], fullname=c['fullname'], password=c['password']) db_session = db.getSession(engine) db_session.add(user) db_session.commit() return 'Created User'
def post_users(): username = request.form['username'] name = request.form['name'] fullname = request.form['fullname'] password = request.form['password'] user = entities.User(username=username, name=name, fullname=fullname, password=password) session = db.getSession(engine) session.add(user) session.commit() return 'Create User'