mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 09:36:49 +03:00
parent
c603b98403
commit
6f6d402d04
|
@ -198,7 +198,7 @@ class PageNumberPagination(BasePagination):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
paginator = self.django_paginator_class(queryset, page_size)
|
paginator = self.django_paginator_class(queryset, page_size)
|
||||||
page_number = request.query_params.get(self.page_query_param, 1)
|
page_number = self.get_page_number(request)
|
||||||
if page_number in self.last_page_strings:
|
if page_number in self.last_page_strings:
|
||||||
page_number = paginator.num_pages
|
page_number = paginator.num_pages
|
||||||
|
|
||||||
|
@ -217,6 +217,9 @@ class PageNumberPagination(BasePagination):
|
||||||
self.request = request
|
self.request = request
|
||||||
return list(self.page)
|
return list(self.page)
|
||||||
|
|
||||||
|
def get_page_number(self, request):
|
||||||
|
return request.query_params.get(self.page_query_param, 1)
|
||||||
|
|
||||||
def get_paginated_response(self, data):
|
def get_paginated_response(self, data):
|
||||||
return Response(OrderedDict([
|
return Response(OrderedDict([
|
||||||
('count', self.page.paginator.count),
|
('count', self.page.paginator.count),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user