mirror of
https://github.com/encode/django-rest-framework.git
synced 2026-03-03 19:41:26 +03:00
Improve PageNumberPagination docs by adding page_query_param customization example (#9904)
* Improve PageNumberPagination docs by adding page_query_param customization example
* Improve pagination accessibility by adding aria attributes and rel navigation hints
* Revert template changes; moved to separate accessibility PR
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Asif Saif Uddin {"Auvi":"অভি"} <auvipy@gmail.com>
Co-authored-by: Bruno Alla <browniebroke@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
190aae3c2d
commit
8d4c2d0843
|
|
@ -97,6 +97,18 @@ To enable the `PageNumberPagination` style globally, use the following configura
|
|||
|
||||
On `GenericAPIView` subclasses you may also set the `pagination_class` attribute to select `PageNumberPagination` on a per-view basis.
|
||||
|
||||
By default, the query parameter name used for pagination is `page`.
|
||||
This can be customized by subclassing `PageNumberPagination` and overriding the `page_query_param` attribute.
|
||||
|
||||
For example:
|
||||
|
||||
from rest_framework.pagination import PageNumberPagination
|
||||
|
||||
class CustomPagination(PageNumberPagination):
|
||||
page_query_param = 'p'
|
||||
|
||||
With this configuration, clients would request pages using `?p=2` instead of `?page=2`.
|
||||
|
||||
#### Configuration
|
||||
|
||||
The `PageNumberPagination` class includes a number of attributes that may be overridden to modify the pagination style.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user