From 3be274347f30e6cd997b89f92d5b16eb47c4c70b Mon Sep 17 00:00:00 2001 From: Kid Binary Date: Mon, 28 Nov 2016 15:01:30 +0200 Subject: [PATCH] django-filters rest_framework module import fix according to official documentation --- docs/api-guide/filtering.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/api-guide/filtering.md b/docs/api-guide/filtering.md index 3f212ced3..2c01ee0ec 100644 --- a/docs/api-guide/filtering.md +++ b/docs/api-guide/filtering.md @@ -187,6 +187,7 @@ This will automatically create a `FilterSet` class for the given fields, and wil For more advanced filtering requirements you can specify a `FilterSet` class that should be used by the view. For example: import django_filters + import django_filters.rest_framework from myapp.models import Product from myapp.serializers import ProductSerializer from rest_framework import generics @@ -213,7 +214,7 @@ You can also span relationships using `django-filter`, let's assume that each product has foreign key to `Manufacturer` model, so we create filter that filters using `Manufacturer` name. For example: - import django_filters + import django_filters.rest_framework from myapp.models import Product from myapp.serializers import ProductSerializer from rest_framework import generics @@ -230,6 +231,7 @@ This enables us to make queries like: This is nice, but it exposes the Django's double underscore convention as part of the API. If you instead want to explicitly name the filter argument you can instead explicitly include it on the `FilterSet` class: import django_filters + import django_filters.rest_framework from myapp.models import Product from myapp.serializers import ProductSerializer from rest_framework import generics