fix(api): common department edit method

This commit is contained in:
hu.sima 2024-01-03 14:30:01 +08:00
parent 224bb6c6bb
commit cdbab0da3d
1 changed files with 2 additions and 2 deletions

View File

@ -62,7 +62,7 @@ class DepartmentView(APIView):
class DepartmentIDView(APIView): class DepartmentIDView(APIView):
url_prefix = (f'{prefix}/<int:_id>',) url_prefix = (f'{prefix}/<int:_id>',)
def get(self, _id): def put(self, _id):
form = DepartmentForm(MultiDict(request.json)) form = DepartmentForm(MultiDict(request.json))
if not form.validate(): if not form.validate():
abort(400, ','.join(['{}: {}'.format(filed, ','.join(msg)) abort(400, ','.join(['{}: {}'.format(filed, ','.join(msg))
@ -85,7 +85,7 @@ class DepartmentIDView(APIView):
class DepartmentParentView(APIView): class DepartmentParentView(APIView):
url_prefix = (f'{prefix}/allow_parent',) url_prefix = (f'{prefix}/allow_parent',)
def put(self): def get(self):
department_id = request.args.get('department_id', None) department_id = request.args.get('department_id', None)
if department_id is None: if department_id is None:
abort(400, ErrFormat.department_id_is_required) abort(400, ErrFormat.department_id_is_required)