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:
kosbemrunal 2026-03-02 00:39:05 +05:30 committed by GitHub
parent 190aae3c2d
commit 8d4c2d0843
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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. 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 #### Configuration
The `PageNumberPagination` class includes a number of attributes that may be overridden to modify the pagination style. The `PageNumberPagination` class includes a number of attributes that may be overridden to modify the pagination style.