Add filtering into documentation

This commit is contained in:
Tom Christie 2012-11-07 21:28:10 +00:00
parent 9fe317b2ca
commit 34c5fb0cc6
3 changed files with 11 additions and 0 deletions

View File

@ -1,3 +1,5 @@
<a class="github" href="filters.py"></a>
# 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.
@ -74,6 +76,8 @@ We can override `.get_queryset()` to deal with URLs such as `http://example.com/
queryset = queryset.filter(purchaser__username=username)
return queryset
---
# 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.
@ -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 that overiding `get_queryset()` can be used together with generic filtering
---
# Custom generic filtering
You can also provide your own generic filtering backend, or write an installable app for other developers to use.

View File

@ -95,6 +95,7 @@ The API guide is your complete reference manual to all the functionality provide
* [Authentication][authentication]
* [Permissions][permissions]
* [Throttling][throttling]
* [Filtering][filtering]
* [Pagination][pagination]
* [Content negotiation][contentnegotiation]
* [Format suffixes][formatsuffixes]
@ -184,6 +185,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[authentication]: api-guide/authentication.md
[permissions]: api-guide/permissions.md
[throttling]: api-guide/throttling.md
[filtering]: api-guide/filtering.md
[pagination]: api-guide/pagination.md
[contentnegotiation]: api-guide/content-negotiation.md
[formatsuffixes]: api-guide/format-suffixes.md

View File

@ -75,6 +75,7 @@
<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/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/content-negotiation{{ suffix }}">Content negotiation</a></li>
<li><a href="{{ base_url }}/api-guide/format-suffixes{{ suffix }}">Format suffixes</a></li>