diff options
| author | Tom Christie | 2013-03-08 20:41:00 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-03-08 20:41:00 +0000 |
| commit | 4d48de631baee39025da04b95f46051d7398bd6c (patch) | |
| tree | 979eb612a93b4ae0c60d099d34b2b7d1fc1f2965 /docs | |
| parent | 5fffaf89e2df8f1213e2a8c3aea7efb35941808c (diff) | |
| download | django-rest-framework-4d48de631baee39025da04b95f46051d7398bd6c.tar.bz2 | |
Docs on per-object filtering
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api-guide/filtering.md | 8 | ||||
| -rw-r--r-- | docs/topics/release-notes.md | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/docs/api-guide/filtering.md b/docs/api-guide/filtering.md index 53ea7cbc..ed946368 100644 --- a/docs/api-guide/filtering.md +++ b/docs/api-guide/filtering.md @@ -140,6 +140,14 @@ For more details on using filter sets see the [django-filter documentation][djan --- +### Filtering and object lookups + +Note that if a filter backend is configured for a view, then as well as being used to filter list views, it will also be used to filter the querysets used for returning a single object. + +For instance, given the previous example, and a product with an id of `4675`, the following URL would either return the corresponding object, or return a 404 response, depending on if the filtering conditions were met by the given product instance: + + http://example.com/api/products/4675/?category=clothing&max_price=10.00 + ## Overriding the initial queryset Note that you can use both an overridden `.get_queryset()` and generic filtering together, and everything will work as expected. For example, if `Product` had a many-to-many relationship with `User`, named `purchase`, you might want to write a view like this: diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 535da433..ab675950 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -40,6 +40,10 @@ You can determine your currently installed version using `pip freeze`: ## 2.2.x series +### Master + +* Filtering backends are now applied to the querysets for object lookups as well as lists. (Eg you can use a filtering backend to control which objects should 404) + ### 2.2.3 **Date**: 7th March 2013 |
