批量删除所属公司2

This commit is contained in:
caoqianming 2023-03-07 13:22:35 +08:00
parent 818021df6e
commit a6ae4bd004
1 changed files with 3 additions and 2 deletions

View File

@ -189,9 +189,10 @@ class CMAViewSet(RecordMixin, ModelViewSet):
array = request.data.get('ids', []) array = request.data.get('ids', [])
sszx = request.data.get('sszx', None) sszx = request.data.get('sszx', None)
if array: if array:
CMA.objects.filter(sszx__id=sszx).delete()
elif sszx:
CMA.objects.filter(pk__in=array).delete() CMA.objects.filter(pk__in=array).delete()
elif sszx:
CMA.objects.filter(sszx=sszx).delete()
return Response(status = status.HTTP_200_OK) return Response(status = status.HTTP_200_OK)
@action(methods=['post'], detail=False, url_path='import', url_name='cma_import', perms_map = {'post':'cma_import'}) @action(methods=['post'], detail=False, url_path='import', url_name='cma_import', perms_map = {'post':'cma_import'})