refector: 删除相关方时将该部门的账户禁用
This commit is contained in:
parent
a3d9fe4606
commit
8a1d43b7b8
|
@ -39,10 +39,13 @@ class RpartyViewSet(CustomModelViewSet):
|
|||
queryset = queryset.filter(dept=user.belong_dept)
|
||||
return queryset
|
||||
|
||||
@transaction.atomic
|
||||
def destroy(self, request, *args, **kwargs):
|
||||
obj = self.get_object()
|
||||
if obj.dept:
|
||||
obj.dept.delete()
|
||||
# 将隶属于该部门的账户禁用
|
||||
User.objects.filter(belong_dept=obj.dept).update(is_deleted=True)
|
||||
obj.delete()
|
||||
return Response(status=204)
|
||||
|
||||
|
|
Loading…
Reference in New Issue