def user_edit(id): user = User.query.filter(User.id==id).first() form = UserEditForm(request.form, user) if form.validate_on_submit(): form.populate_obj(user) db.session.commit() return redirect(url_for("account.user_list")) return render_template('account/user_edit.html', form=form)
def user_add(): form = UserEditForm(request.form) if form.validate_on_submit(): user = User() form.populate_obj(user) db.session.add(user) db.session.commit() return redirect(url_for("account.user_list")) return render_template('account/user_edit.html', form=form)