def admin_update(id): edit_one_field = request.form.get('edit_one_field', None) if not edit_one_field: form = AdminEditForm(formdata=request.form, id=id) else: form = AdminEditOneKeyForm(formdata=request.form, id=id) if not form.validate(): return Fail(message=form.first_error) admin = Admin.get_by_id(id=id) admin.update(form.data, edit_one_field) return Success(message="操作成功!")
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)