def admin_profile(): form = AdminProfileForm(request.form) if request.method == "POST": if form.validate(): user = current_user with db.auto_commit(): user.set_attrs(form.data) return Success(message="操作成功!") return Fail(message=form.first_error) else: roles = Role.get_all() return render_template('admin/admin/profile.html', roles=roles)
def admin_edit(id): admin = Admin.get_by_id(id) roles = Role.get_all() return render_template('admin/admin/edit.html', admin=admin, roles=roles)
def admin_create(): roles = Role.get_all() return render_template('admin/admin/create.html', roles=roles)