Skip to content

Commit 8d4c2d0

Browse files
kosbemrunalauvipybrowniebrokeCopilot
authored
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>
1 parent 190aae3 commit 8d4c2d0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/api-guide/pagination.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,18 @@ To enable the `PageNumberPagination` style globally, use the following configura
9797

9898
On `GenericAPIView` subclasses you may also set the `pagination_class` attribute to select `PageNumberPagination` on a per-view basis.
9999

100+
By default, the query parameter name used for pagination is `page`.
101+
This can be customized by subclassing `PageNumberPagination` and overriding the `page_query_param` attribute.
102+
103+
For example:
104+
105+
from rest_framework.pagination import PageNumberPagination
106+
107+
class CustomPagination(PageNumberPagination):
108+
page_query_param = 'p'
109+
110+
With this configuration, clients would request pages using `?p=2` instead of `?page=2`.
111+
100112
#### Configuration
101113

102114
The `PageNumberPagination` class includes a number of attributes that may be overridden to modify the pagination style.

0 commit comments

Comments
 (0)