Selaa lähdekoodia

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 10 vuotta sitten
vanhempi
commit
70c86df35e
1 muutettua tiedostoa jossa 3 lisäystä ja 0 poistoa
  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)