Commit 4d48de63 by Tom Christie

Docs on per-object filtering

parent 5fffaf89
...@@ -140,6 +140,14 @@ For more details on using filter sets see the [django-filter documentation][djan ...@@ -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 ## 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: 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:
......
...@@ -40,6 +40,10 @@ You can determine your currently installed version using `pip freeze`: ...@@ -40,6 +40,10 @@ You can determine your currently installed version using `pip freeze`:
## 2.2.x series ## 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 ### 2.2.3
**Date**: 7th March 2013 **Date**: 7th March 2013
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment