Skip to content

Allow 'get_page' method for overriding #7626

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

Closed

Conversation

PaulWay
Copy link
Contributor

@PaulWay PaulWay commented Nov 4, 2020

In some instances, it may be necessary for subclasses to override the way the page number is resolved. This work implements a get_page method, like the get_page_size method, to allow this to be overridden.

This also enforces that page numbers must be greater than zero. Without this, page=0 and similar will return a 404.

Signed-off-by: Paul Wayper [email protected]

Copy link
Collaborator

@xordoquy xordoquy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you can see, enforcing positive page number just breaks the build.
The addition of _positive_int set appart, I think I'll be ok with this change.

@xordoquy xordoquy added this to the 3.13 Release milestone Nov 4, 2020
@PaulWay
Copy link
Contributor Author

PaulWay commented Nov 4, 2020

OK, I've updated the method name and it just converts to integer. Should we catch ValueErrors there?

@tomchristie
Copy link
Member

Closed in favour of #7652

stefanacin pushed a commit to stefanacin/django-rest-framework that referenced this pull request Mar 22, 2021
@tomchristie tomchristie removed this from the 3.13 Release milestone Mar 25, 2021
sigvef pushed a commit to sigvef/django-rest-framework that referenced this pull request Dec 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants