diff options
| author | Federico Jaramillo Martínez <federicojaramillom@gmail.com> | 2018-01-05 23:53:51 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-01-03 07:58:04 +0100 |
| commit | 372eaa395f167c038e546c6be554c96014d40109 (patch) | |
| tree | c4809fba27079ace0bbfdba85e316af7f90e4c6c /docs | |
| parent | 03f6159407600de8b98992e675c45bffde9fca5b (diff) | |
Fixed #28991 -- Added EmptyFieldListFilter class in admin.filters.
Thanks Simon Charette and Carlton Gibson for reviews.
Co-Authored-By: Jonas Haag <jonas@lophus.org>
Co-Authored-By: Christophe Baldy <christophe.baldy@polyconseil.fr>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/admin/index.txt | 13 | ||||
| -rw-r--r-- | docs/releases/3.1.txt | 4 |
2 files changed, 16 insertions, 1 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 669fc185a4..6bffa6850c 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -971,11 +971,24 @@ subclass:: limit the ``list_filter`` choices to the users who have written a book instead of listing all users. + You can filter empty values using ``EmptyFieldListFilter``, which can + filter on both empty strings and nulls, depending on what the field + allows to store:: + + class BookAdmin(admin.ModelAdmin): + list_filter = ( + ('title', admin.EmptyFieldListFilter), + ) + .. note:: The ``FieldListFilter`` API is considered internal and might be changed. + .. versionadded:: 3.1 + + The ``EmptyFieldListFilter`` class was added. + List filter's typically appear only if the filter has more than one choice. A filter's ``has_output()`` method controls whether or not it appears. diff --git a/docs/releases/3.1.txt b/docs/releases/3.1.txt index 51a0c69ac6..6b7e73c431 100644 --- a/docs/releases/3.1.txt +++ b/docs/releases/3.1.txt @@ -33,7 +33,9 @@ Minor features :mod:`django.contrib.admin` ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* ... +* The new ``django.contrib.admin.EmptyFieldListFilter`` for + :attr:`.ModelAdmin.list_filter` allows filtering on empty values (empty + strings and nulls) in the admin changelist view. :mod:`django.contrib.admindocs` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
