From 8d4c2d0843b9dfd9c965f6ecd97b4260a60ce7d7 Mon Sep 17 00:00:00 2001 From: kosbemrunal Date: Mon, 2 Mar 2026 00:39:05 +0530 Subject: [PATCH] Improve `PageNumberPagination` docs by adding `page_query_param` customization example (#9904) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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":"অভি"} Co-authored-by: Bruno Alla Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docs/api-guide/pagination.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/api-guide/pagination.md b/docs/api-guide/pagination.md index e4e5f4979..e9ae999ea 100644 --- a/docs/api-guide/pagination.md +++ b/docs/api-guide/pagination.md @@ -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.