mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-29 21:14:01 +03:00
Add filtering into documentation
This commit is contained in:
parent
9fe317b2ca
commit
34c5fb0cc6
|
@ -1,3 +1,5 @@
|
||||||
|
<a class="github" href="filters.py"></a>
|
||||||
|
|
||||||
# Filtering
|
# Filtering
|
||||||
|
|
||||||
> The root QuerySet provided by the Manager describes all objects in the database table. Usually, though, you'll need to select only a subset of the complete set of objects.
|
> The root QuerySet provided by the Manager describes all objects in the database table. Usually, though, you'll need to select only a subset of the complete set of objects.
|
||||||
|
@ -74,6 +76,8 @@ We can override `.get_queryset()` to deal with URLs such as `http://example.com/
|
||||||
queryset = queryset.filter(purchaser__username=username)
|
queryset = queryset.filter(purchaser__username=username)
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
# Generic Filtering
|
# Generic Filtering
|
||||||
|
|
||||||
As well as being able to override the default queryset, REST framework also includes support for generic filtering backends that allow you to easily construct complex filters that can be specified by the client using query parameters.
|
As well as being able to override the default queryset, REST framework also includes support for generic filtering backends that allow you to easily construct complex filters that can be specified by the client using query parameters.
|
||||||
|
@ -96,6 +100,10 @@ To use REST framework's default filtering backend, first install `django-filter`
|
||||||
|
|
||||||
**TODO**: Note support for `lookup_type`, double underscore relationship spanning, and ordering.
|
**TODO**: Note support for `lookup_type`, double underscore relationship spanning, and ordering.
|
||||||
|
|
||||||
|
**TODO**: Note that overiding `get_queryset()` can be used together with generic filtering
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
# Custom generic filtering
|
# Custom generic filtering
|
||||||
|
|
||||||
You can also provide your own generic filtering backend, or write an installable app for other developers to use.
|
You can also provide your own generic filtering backend, or write an installable app for other developers to use.
|
||||||
|
|
|
@ -95,6 +95,7 @@ The API guide is your complete reference manual to all the functionality provide
|
||||||
* [Authentication][authentication]
|
* [Authentication][authentication]
|
||||||
* [Permissions][permissions]
|
* [Permissions][permissions]
|
||||||
* [Throttling][throttling]
|
* [Throttling][throttling]
|
||||||
|
* [Filtering][filtering]
|
||||||
* [Pagination][pagination]
|
* [Pagination][pagination]
|
||||||
* [Content negotiation][contentnegotiation]
|
* [Content negotiation][contentnegotiation]
|
||||||
* [Format suffixes][formatsuffixes]
|
* [Format suffixes][formatsuffixes]
|
||||||
|
@ -184,6 +185,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
[authentication]: api-guide/authentication.md
|
[authentication]: api-guide/authentication.md
|
||||||
[permissions]: api-guide/permissions.md
|
[permissions]: api-guide/permissions.md
|
||||||
[throttling]: api-guide/throttling.md
|
[throttling]: api-guide/throttling.md
|
||||||
|
[filtering]: api-guide/filtering.md
|
||||||
[pagination]: api-guide/pagination.md
|
[pagination]: api-guide/pagination.md
|
||||||
[contentnegotiation]: api-guide/content-negotiation.md
|
[contentnegotiation]: api-guide/content-negotiation.md
|
||||||
[formatsuffixes]: api-guide/format-suffixes.md
|
[formatsuffixes]: api-guide/format-suffixes.md
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
<li><a href="{{ base_url }}/api-guide/authentication{{ suffix }}">Authentication</a></li>
|
<li><a href="{{ base_url }}/api-guide/authentication{{ suffix }}">Authentication</a></li>
|
||||||
<li><a href="{{ base_url }}/api-guide/permissions{{ suffix }}">Permissions</a></li>
|
<li><a href="{{ base_url }}/api-guide/permissions{{ suffix }}">Permissions</a></li>
|
||||||
<li><a href="{{ base_url }}/api-guide/throttling{{ suffix }}">Throttling</a></li>
|
<li><a href="{{ base_url }}/api-guide/throttling{{ suffix }}">Throttling</a></li>
|
||||||
|
<li><a href="{{ base_url }}/api-guide/filtering{{ suffix }}">Filtering</a></li>
|
||||||
<li><a href="{{ base_url }}/api-guide/pagination{{ suffix }}">Pagination</a></li>
|
<li><a href="{{ base_url }}/api-guide/pagination{{ suffix }}">Pagination</a></li>
|
||||||
<li><a href="{{ base_url }}/api-guide/content-negotiation{{ suffix }}">Content negotiation</a></li>
|
<li><a href="{{ base_url }}/api-guide/content-negotiation{{ suffix }}">Content negotiation</a></li>
|
||||||
<li><a href="{{ base_url }}/api-guide/format-suffixes{{ suffix }}">Format suffixes</a></li>
|
<li><a href="{{ base_url }}/api-guide/format-suffixes{{ suffix }}">Format suffixes</a></li>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user