def create(): """ Create role. :return: """ if request.form: form = RoleForm(MultiDict(request.form)) else: form = RoleForm() if form.validate_on_submit(): roles.create_role(**request.form) else: return {}, 500 return {}
def update(role_id): """ Update role information. @login_required :param role_id: :return: role, password_incorrect, status """ if request.form: form = RoleForm(MultiDict(request.form)) else: form = RoleForm() role = roles.get_or_404(role_id) if form.validate_on_submit(): roles.update_role(role, **request.form) else: return {}, 500 return {'role': role}