From 00631aba4aa3e232d9c4b961c85a0a82558feb95 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Fri, 26 Feb 2021 21:01:59 +0900 Subject: [PATCH] Add bulk delete API for label --- app/api/views/label.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/api/views/label.py b/app/api/views/label.py index 7ddaf0a6..151c364a 100644 --- a/app/api/views/label.py +++ b/app/api/views/label.py @@ -27,6 +27,11 @@ class LabelList(generics.ListCreateAPIView): project = get_object_or_404(Project, pk=self.kwargs['project_id']) serializer.save(project=project) + def delete(self, request, *args, **kwargs): + delete_ids = request.data['ids'] + Label.objects.filter(pk__in=delete_ids).delete() + return Response(status=status.HTTP_204_NO_CONTENT) + class LabelDetail(generics.RetrieveUpdateDestroyAPIView): queryset = Label.objects.all()