Browse Source

Add bulk delete for member

pull/1224/head
Hironsan 3 years ago
parent
commit
ab66e797fb
1 changed files with 7 additions and 1 deletions
  1. 8
      app/api/views/role.py

8
app/api/views/role.py

@ -1,6 +1,7 @@
from django.shortcuts import get_object_or_404
from rest_framework import generics
from rest_framework import generics, status
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from ..models import Project, Role, RoleMapping
from ..permissions import IsProjectAdmin
@ -27,6 +28,11 @@ class RoleMappingList(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']
RoleMapping.objects.filter(pk__in=delete_ids).delete()
return Response(status=status.HTTP_204_NO_CONTENT)
class RoleMappingDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = RoleMapping.objects.all()

Loading…
Cancel
Save