Quellcode durchsuchen

Add a get_object method to BulkUpdateModelMixin

Some Django REST Framework methods expect a get_object method when they see that PUT requests are allowed (e.g., GenericAPIView.metadata). For a bulk update view, the object being modified is the queryset itself, so we return that.
Mjumbe Wawatu Ukweli vor 10 Jahren
Ursprung
Commit
70c86df35e
1 geänderte Dateien mit 3 neuen und 0 gelöschten Zeilen
  1. 3 0
      rest_framework_bulk/mixins.py

+ 3 - 0
rest_framework_bulk/mixins.py

@@ -42,6 +42,9 @@ class BulkUpdateModelMixin(object):
     ``many=True`` ability from Django REST >= 2.2.5.
     """
 
+    def get_object(self):
+        return self.get_queryset()
+
     def bulk_update(self, request, *args, **kwargs):
         partial = kwargs.pop('partial', False)