Example #1
0
def index(request):
    user_form = UserForm(request.POST)
    if request.method == "POST" and user_form.validate():
        new_user = UserMgr.new(username=user_form.username.data)
        print("new_user: "******"user_form": user_form}
Example #2
0
 def validate_username(form, field):
     form.user = UserMgr.one(username=field.data)
     if form.user is None:
         msg = field.data + " isn't a registered user."
         raise val.StopValidation(msg)
Example #3
0
 def validate_username(form, field):
     if UserMgr.one(username=field.data):
         msg = "Username {} is taken".format(field.data)
         raise wtforms.ValidationError(msg)
Example #4
0
def home(request):
    all_users = UserMgr.get().all()
    return {"all_users": all_users}