@decorator_authorized_user # This decorator should make sure the user is authorized, like @login_required from flask-login def editprofile(nickname = None): # Prepare the form and user form = EditProfile() form_action = url_for('profile.editprofile') my_user = Users.get(...) # get your user object or whatever you need if request.method == 'GET': form.username.data = my_user.username form.email.data = my_user.email # and on if form.validate_on_submit(): # This section needs to be reworked. # You'll want to take the user object and set the appropriate attributes # to the appropriate values from the form. if form.username.data == nickname: query = EditProfile(form.username.data, form.email.data, form.about.data, form.website.data, ) print query #debug db.session.add(query) db.session.commit() flash('User Updated') print "added" return(url_for('profile.editprofile')) return render_template('profile/add.html', form=form, form_action=form_action, title="Update Profile")

how to pre populate field flask wtforms

Similar Code Examples