Beispiel #1
0
def permission_update(id):
    edit_one_field = request.form.get('edit_one_field', None)
    if not edit_one_field:
        form = PermissionEditForm(formdata=request.form, id=id)
    else:
        form = PermissionEditOneKeyForm(formdata=request.form, id=id)
    if not form.validate():
        return Fail(message=form.first_error)
    permission = Permission.get_by_id(id=id)
    permission.update(form.data, edit_one_field)

    return Success(message="操作成功!")
Beispiel #2
0
def permission_edit(id):
    permission = Permission.get_by_id(id)
    menus = Menu.get_all(is_group=True)
    return render_template('admin/permission/edit.html',
                           permission=permission,
                           menus=menus)