def hello(): userAccess = UserAccess() if request.method == 'POST': result = request.form newUser = User() for key, value in result.items(): if key == "txtname": newUser.username = value elif key == "txtpass": newUser.password = value elif key == "txtemail": newUser.email = value userAccess.InsertUser(newUser) users = userAccess.GetUsers() return render_template("index.html", users=users)
def insert_user(): userAccess = UserAccess() user = json.loads(json.dumps(request.json, cls=DateTimeEncoder), object_hook=User) result = userAccess.InsertUser(user) return JSONEncoder().encode(result)