def profile_edit(): form = ProfileForm(obj=g.user) form.fullname.description = app.config.get('FULLNAME_REASON') form.username.description = app.config.get('USERNAME_REASON') form.description.description = app.config.get('BIO_REASON') if form.validate_on_submit(): form.populate_obj(g.user) db.session.commit() flash("Your profile was successfully edited.", category='success') return render_redirect(url_for('profile'), code=303) return render_form(form, title="Edit profile", formid="profile_edit", submit="Save changes", ajax=True)
def profile_edit(): form = ProfileForm(obj=g.user) form.edit_obj = g.user if form.validate_on_submit(): form.populate_obj(g.user) db.session.commit() next_url = get_next_url() if next_url is not None: return render_redirect(next_url) else: flash("Your profile was successfully edited.", category="info") return render_redirect(url_for("profile"), code=303) return render_form(form, title="Edit profile", formid="profile_edit", submit="Save changes", ajax=True)