-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Make DEFAULT_PAGINATION_CLASS None by default.
#5170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e52d31d
Changes to the paginator defaults and settings
matteius a224b6b
DRF-5168 import warnings
matteius 420bc48
Add a system checks file
matteius 64bc395
more compatible import approach
matteius f34da6d
missing bactic
matteius 7a0a5c3
revised language and approach to import the system check
matteius dd8979d
Adjust doc wording
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add a system checks file
Add a check for pagination settings for the 3.7 upgrade cycle.
- Loading branch information
commit 420bc48cfdb5336656cd54d5557703e39618c92e
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| from django.core.checks import Tags, Warning, register | ||
|
|
||
|
|
||
| @register(Tags.compatibility) | ||
| def pagination_system_check(app_configs, **kwargs): | ||
| errors = [] | ||
| # Use of default page size setting requires a default Paginator class | ||
| from rest_framework.settings import api_settings | ||
| if api_settings.PAGE_SIZE and not api_settings.DEFAULT_PAGINATION_CLASS: | ||
| errors.append( | ||
| Warning( | ||
| "You have specified a default PAGE_SIZE` pagination rest_framework setting," | ||
| "without specifying also a `DEFAULT_PAGINATION_CLASS`.", | ||
| hint="The prior version of rest_framework defaulted this setting to " | ||
| "`PageNumberPagination` however pagination defaults to disabled now. " | ||
| "Consider specifying `DEFAULT_PAGINATION_CLASS` explicitly for your project, " | ||
| "unless you specify individual pagination_class values on specific view classes.", | ||
| ) | ||
| ) | ||
| return errors | ||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The default for
DEFAULT_PAGINATION_CLASSisNone. (In previous versions this wasPageNumberPagination)"