mirror of
https://github.com/encode/django-rest-framework.git
synced 2026-03-02 19:11:24 +03:00
Deployed 8d4c2d0 with MkDocs version: 1.6.1
This commit is contained in:
parent
c019f4a6fa
commit
842f82c77a
|
|
@ -2734,6 +2734,15 @@ class StandardResultsSetPagination(PageNumberPagination):
|
|||
}
|
||||
</code></pre></div>
|
||||
<p>On <code>GenericAPIView</code> subclasses you may also set the <code>pagination_class</code> attribute to select <code>PageNumberPagination</code> on a per-view basis.</p>
|
||||
<p>By default, the query parameter name used for pagination is <code>page</code>.
|
||||
This can be customized by subclassing <code>PageNumberPagination</code> and overriding the <code>page_query_param</code> attribute.</p>
|
||||
<p>For example:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code>from rest_framework.pagination import PageNumberPagination
|
||||
|
||||
class CustomPagination(PageNumberPagination):
|
||||
page_query_param = 'p'
|
||||
</code></pre></div>
|
||||
<p>With this configuration, clients would request pages using <code>?p=2</code> instead of <code>?page=2</code>.</p>
|
||||
<h4 id="configuration">Configuration<a class="headerlink" href="#configuration" title="Permanent link">¶</a></h4>
|
||||
<p>The <code>PageNumberPagination</code> class includes a number of attributes that may be overridden to modify the pagination style.</p>
|
||||
<p>To set these attributes you should override the <code>PageNumberPagination</code> class, and then enable your custom pagination class as above.</p>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user