mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-10-10 22:07:01 +03:00
improved docs/api-guide/filtering.md for better understanding (#9795)
This commit is contained in:
parent
5cc16335ee
commit
a323cf7c0a
|
@ -235,7 +235,7 @@ For example:
|
||||||
|
|
||||||
search_fields = ['=username', '=email']
|
search_fields = ['=username', '=email']
|
||||||
|
|
||||||
By default, the search parameter is named `'search'`, but this may be overridden with the `SEARCH_PARAM` setting.
|
By default, the search parameter is named `'search'`, but this may be overridden with the `SEARCH_PARAM` setting in the `REST_FRAMEWORK` configuration.
|
||||||
|
|
||||||
To dynamically change search fields based on request content, it's possible to subclass the `SearchFilter` and override the `get_search_fields()` function. For example, the following subclass will only search on `title` if the query parameter `title_only` is in the request:
|
To dynamically change search fields based on request content, it's possible to subclass the `SearchFilter` and override the `get_search_fields()` function. For example, the following subclass will only search on `title` if the query parameter `title_only` is in the request:
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ The `OrderingFilter` class supports simple query parameter controlled ordering o
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
By default, the query parameter is named `'ordering'`, but this may be overridden with the `ORDERING_PARAM` setting.
|
By default, the query parameter is named `'ordering'`, but this may be overridden with the `ORDERING_PARAM` setting in the `REST_FRAMEWORK` configuration.
|
||||||
|
|
||||||
For example, to order users by username:
|
For example, to order users by username:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user