Make it more clear to add django_filters to INSTALLED_APPS in docs. (#7535)

This commit is contained in:
johnthagen 2020-09-14 13:46:51 -04:00 committed by GitHub
parent 04f39c42ee
commit e17779c47b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -145,10 +145,18 @@ Note that you can use both an overridden `.get_queryset()` and generic filtering
The [`django-filter`][django-filter-docs] library includes a `DjangoFilterBackend` class which
supports highly customizable field filtering for REST framework.
To use `DjangoFilterBackend`, first install `django-filter`. Then add `django_filters` to Django's `INSTALLED_APPS`
To use `DjangoFilterBackend`, first install `django-filter`.
pip install django-filter
Then add `'django_filters'` to Django's `INSTALLED_APPS`:
INSTALLED_APPS = [
...
'django_filters',
...
]
You should now either add the filter backend to your settings:
REST_FRAMEWORK = {
@ -365,4 +373,4 @@ The [djangorestframework-word-filter][django-rest-framework-word-search-filter]
[django-url-filter]: https://github.com/miki725/django-url-filter
[drf-url-filter]: https://github.com/manjitkumar/drf-url-filters
[HStoreField]: https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/fields/#hstorefield
[JSONField]: https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/fields/#jsonfield
[JSONField]: https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/fields/#jsonfield