-
-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add settings to allow changing the default and the maximum REST API page size. Signed-off-by: Roberto Rosario <[email protected]>
- Loading branch information
Roberto Rosario
committed
Oct 19, 2021
1 parent
65d9e6e
commit 2f9f662
Showing
4 changed files
with
30 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
API_VERSION = '4' | ||
DEFAULT_MAX_PAGE_SIZE = 100 | ||
DEFAULT_PAGE_SIZE = 10 | ||
|
||
DEFAULT_PAGE_SIZE_QUERY_PARAMETER = 'page_size' | ||
DEFAULT_REST_API_DISABLE_LINKS = False | ||
DEFAULT_REST_API_MAXIMUM_PAGE_SIZE = 100 | ||
DEFAULT_REST_API_PAGE_SIZE = 10 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
from rest_framework import pagination | ||
|
||
from .literals import ( | ||
DEFAULT_MAX_PAGE_SIZE, DEFAULT_PAGE_SIZE, | ||
DEFAULT_PAGE_SIZE_QUERY_PARAMETER | ||
) | ||
from .literals import DEFAULT_PAGE_SIZE_QUERY_PARAMETER | ||
from .settings import setting_maximum_page_size, setting_page_size | ||
|
||
|
||
class MayanPageNumberPagination(pagination.PageNumberPagination): | ||
max_page_size = DEFAULT_MAX_PAGE_SIZE | ||
page_size = DEFAULT_PAGE_SIZE | ||
max_page_size = setting_maximum_page_size.value | ||
page_size = setting_page_size.value | ||
page_size_query_param = DEFAULT_PAGE_SIZE_QUERY_PARAMETER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters