corrected an error in the filtering api-guide

I found the latest version of django-filter requires a list of field
attributes instead of a tuple. This might help others who are looking
over the docs as I got an error trying to implement this using the wrong
data structure

"django-filter Meta.fields contains a field that isn't defined on this
FilterSet ..."
This commit is contained in:
toran billups 2013-02-10 13:24:39 -06:00
parent 29136ef2c6
commit 4af51b402f

View File

@ -102,7 +102,7 @@ If all you need is simple equality-based filtering, you can set a `filter_fields
class ProductList(generics.ListAPIView):
model = Product
serializer_class = ProductSerializer
filter_fields = ('category', 'in_stock')
filter_fields = ['category', 'in_stock']
This will automatically create a `FilterSet` class for the given fields, and will allow you to make requests such as: