mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 12:30:11 +03:00
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:
parent
6fb96e93ef
commit
d7799c32c8
|
@ -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,7 +81,10 @@ class GenericAPIView(views.APIView):
|
|||
queryset lookups. Eg if objects are referenced using multiple
|
||||
keyword arguments in the url conf.
|
||||
"""
|
||||
queryset = self.filter_queryset(self.get_queryset())
|
||||
if queryset is not None:
|
||||
queryset = self.filter_queryset(queryset)
|
||||
else:
|
||||
queryset = self.filter_queryset(self.get_queryset())
|
||||
|
||||
# Perform the lookup filtering.
|
||||
lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field
|
||||
|
|
Loading…
Reference in New Issue
Block a user