Changing signature for get_object() within GenericAPIView to match with Django's SingleObjectMixin's signature for get_object() by adding a kwarg for queryset.

This commit is contained in:
disturbedmime 2015-10-03 14:07:36 -07:00
parent 6fb96e93ef
commit d7799c32c8

View File

@ -73,7 +73,7 @@ class GenericAPIView(views.APIView):
queryset = queryset.all()
return queryset
def get_object(self):
def get_object(self, queryset=None):
"""
Returns the object the view is displaying.
@ -81,6 +81,9 @@ class GenericAPIView(views.APIView):
queryset lookups. Eg if objects are referenced using multiple
keyword arguments in the url conf.
"""
if queryset is not None:
queryset = self.filter_queryset(queryset)
else:
queryset = self.filter_queryset(self.get_queryset())
# Perform the lookup filtering.