追加任务bug

This commit is contained in:
caoqianming 2021-04-02 17:24:22 +08:00
parent f16bf41793
commit bafe8bbaed
1 changed files with 22 additions and 22 deletions

View File

@ -100,7 +100,6 @@ class TaskViewSet(CreateUpdateCustomMixin, ModelViewSet):
depts = request.data['depts'] depts = request.data['depts']
contents = request.data['contents'] contents = request.data['contents']
if obj.state in ['待发布', '执行中']: if obj.state in ['待发布', '执行中']:
return Response('任务状态错误', status=status.HTTP_400_BAD_REQUEST)
if depts and contents: if depts and contents:
for m in depts: for m in depts:
m = Organization.objects.get(pk=m) m = Organization.objects.get(pk=m)
@ -121,6 +120,7 @@ class TaskViewSet(CreateUpdateCustomMixin, ModelViewSet):
obj.save() obj.save()
return Response(status=status.HTTP_200_OK) return Response(status=status.HTTP_200_OK)
return Response('单位或清单不能为空', status=status.HTTP_400_BAD_REQUEST) return Response('单位或清单不能为空', status=status.HTTP_400_BAD_REQUEST)
return Response('任务状态错误', status=status.HTTP_400_BAD_REQUEST)
@action(methods=['get'], detail=True, perms_map = {'get':'*'}) @action(methods=['get'], detail=True, perms_map = {'get':'*'})