From 4af51b402f0c28757e01915b9df5721aac0802e8 Mon Sep 17 00:00:00 2001 From: toran billups Date: Sun, 10 Feb 2013 13:24:39 -0600 Subject: [PATCH] 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 ..." --- docs/api-guide/filtering.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api-guide/filtering.md b/docs/api-guide/filtering.md index 53ea7cbcc..8e7dd0a91 100644 --- a/docs/api-guide/filtering.md +++ b/docs/api-guide/filtering.md @@ -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: @@ -175,4 +175,4 @@ For example: [cite]: https://docs.djangoproject.com/en/dev/topics/db/queries/#retrieving-specific-objects-with-filters [django-filter]: https://github.com/alex/django-filter [django-filter-docs]: https://django-filter.readthedocs.org/en/latest/index.html -[nullbooleanselect]: https://github.com/django/django/blob/master/django/forms/widgets.py \ No newline at end of file +[nullbooleanselect]: https://github.com/django/django/blob/master/django/forms/widgets.py