mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 01:26:53 +03:00
Fix 'get_page_number' implementation
This commit is contained in:
parent
c05cbe2da2
commit
39a98c80a6
|
@ -198,7 +198,7 @@ class PageNumberPagination(BasePagination):
|
|||
return None
|
||||
|
||||
paginator = self.django_paginator_class(queryset, page_size)
|
||||
page_number = self.get_page_number(request)
|
||||
page_number = self.get_page_number(request, paginator)
|
||||
|
||||
try:
|
||||
self.page = paginator.page(page_number)
|
||||
|
@ -215,7 +215,7 @@ class PageNumberPagination(BasePagination):
|
|||
self.request = request
|
||||
return list(self.page)
|
||||
|
||||
def get_page_number(self, request):
|
||||
def get_page_number(self, request, paginator):
|
||||
page_number = request.query_params.get(self.page_query_param, 1)
|
||||
if page_number in self.last_page_strings:
|
||||
page_number = paginator.num_pages
|
||||
|
|
Loading…
Reference in New Issue
Block a user