Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions rest_framework/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,6 @@ class PageNumberPagination(BasePagination):
http://api.example.org/accounts/?page=4
http://api.example.org/accounts/?page=4&page_size=100
"""
# The default page size.
# Defaults to `None`, meaning pagination is disabled.
page_size = api_settings.PAGE_SIZE

django_paginator_class = DjangoPaginator

Expand All @@ -191,6 +188,13 @@ class PageNumberPagination(BasePagination):

invalid_page_message = _('Invalid page.')

@property
def page_size(self):
# The default page size.
# Defaults to `None`, meaning pagination is disabled.
# Property so that PAGE_SIZE can be overriden by @override_settings
return api_settings.PAGE_SIZE

def paginate_queryset(self, queryset, request, view=None):
"""
Paginate a queryset if required, either returning a
Expand Down