Sfoglia il codice sorgente

Added ListBulkCreateDestroyAPIView to generics

Davide Mendolia 10 anni fa
parent
commit
748c78d12e
1 ha cambiato i file con 14 aggiunte e 0 eliminazioni
  1. 14 0
      rest_framework_bulk/generics.py

+ 14 - 0
rest_framework_bulk/generics.py

@@ -119,3 +119,17 @@ class ListBulkCreateUpdateDestroyAPIView(mixins.ListModelMixin,
 
     def delete(self, request, *args, **kwargs):
         return self.bulk_destroy(request, *args, **kwargs)
+
+
+class ListBulkCreateDestroyAPIView(mixins.ListModelMixin,
+                                   bulk_mixins.BulkCreateModelMixin,
+                                   bulk_mixins.BulkDestroyModelMixin,
+                                   GenericAPIView):
+    def get(self, request, *args, **kwargs):
+        return self.list(request, *args, **kwargs)
+
+    def post(self, request, *args, **kwargs):
+        return self.create(request, *args, **kwargs)
+
+    def delete(self, request, *args, **kwargs):
+        return self.bulk_destroy(request, *args, **kwargs)