Merge pull request #3017 from nmandery/feature/set-filter_backends-in-api-docs

Set the filter_backends class variable in the DjangoFilterBackend docs
This commit is contained in:
Xavier Ordoquy 2015-06-09 10:29:34 +02:00
commit 2749b12eaf

View File

@ -149,6 +149,7 @@ If all you need is simple equality-based filtering, you can set a `filter_fields
class ProductList(generics.ListAPIView):
queryset = Product.objects.all()
serializer_class = ProductSerializer
filter_backends = (filters.DjangoFilterBackend,)
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:
@ -174,6 +175,7 @@ For more advanced filtering requirements you can specify a `FilterSet` class tha
class ProductList(generics.ListAPIView):
queryset = Product.objects.all()
serializer_class = ProductSerializer
filter_backends = (filters.DjangoFilterBackend,)
filter_class = ProductFilter