mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 19:43:59 +03:00
retract the default page stuff.
better way comming in a seperate pr
This commit is contained in:
parent
63e6a3b492
commit
f0a129dcda
|
@ -145,15 +145,7 @@ class GenericAPIView(views.APIView):
|
||||||
allow_empty_first_page=self.allow_empty)
|
allow_empty_first_page=self.allow_empty)
|
||||||
page_kwarg = self.kwargs.get(self.page_kwarg)
|
page_kwarg = self.kwargs.get(self.page_kwarg)
|
||||||
page_query_param = self.request.QUERY_PARAMS.get(self.page_kwarg)
|
page_query_param = self.request.QUERY_PARAMS.get(self.page_kwarg)
|
||||||
page = page_kwarg or page_query_param
|
page = page_kwarg or page_query_param or 1
|
||||||
if not page:
|
|
||||||
# we didn't recieve a page
|
|
||||||
if hasattr(paginator, 'default_page_number'):
|
|
||||||
# our paginator has a method that will provide a default
|
|
||||||
page = paginator.default_page_number()
|
|
||||||
else:
|
|
||||||
# fall back on the base default value
|
|
||||||
page = 1
|
|
||||||
try:
|
try:
|
||||||
page_number = paginator.validate_number(page)
|
page_number = paginator.validate_number(page)
|
||||||
except InvalidPage:
|
except InvalidPage:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user