mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-10-17 17:24:34 +03:00
Deployed a323cf7
with MkDocs version: 1.6.0
This commit is contained in:
parent
039415bb21
commit
5031b247cb
|
@ -733,7 +733,7 @@ class UserListView(generics.ListAPIView):
|
|||
<p>For example:</p>
|
||||
<pre><code>search_fields = ['=username', '=email']
|
||||
</code></pre>
|
||||
<p>By default, the search parameter is named <code>'search'</code>, but this may be overridden with the <code>SEARCH_PARAM</code> setting.</p>
|
||||
<p>By default, the search parameter is named <code>'search'</code>, but this may be overridden with the <code>SEARCH_PARAM</code> setting in the <code>REST_FRAMEWORK</code> configuration.</p>
|
||||
<p>To dynamically change search fields based on request content, it's possible to subclass the <code>SearchFilter</code> and override the <code>get_search_fields()</code> function. For example, the following subclass will only search on <code>title</code> if the query parameter <code>title_only</code> is in the request:</p>
|
||||
<pre><code>from rest_framework import filters
|
||||
|
||||
|
@ -748,7 +748,7 @@ class CustomSearchFilter(filters.SearchFilter):
|
|||
<h2 id="orderingfilter"><a class="toclink" href="#orderingfilter">OrderingFilter</a></h2>
|
||||
<p>The <code>OrderingFilter</code> class supports simple query parameter controlled ordering of results.</p>
|
||||
<p><img alt="Ordering Filter" src="../../img/ordering-filter.png" /></p>
|
||||
<p>By default, the query parameter is named <code>'ordering'</code>, but this may be overridden with the <code>ORDERING_PARAM</code> setting.</p>
|
||||
<p>By default, the query parameter is named <code>'ordering'</code>, but this may be overridden with the <code>ORDERING_PARAM</code> setting in the <code>REST_FRAMEWORK</code> configuration.</p>
|
||||
<p>For example, to order users by username:</p>
|
||||
<pre><code>http://example.com/api/users?ordering=username
|
||||
</code></pre>
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user