Opened 4 months ago

Last modified 3 months ago

#28991 new New feature

Add an admin filter with choices "all", "blank", "not blank"

Reported by: Jonas Haag Owned by: nobody
Component: contrib.admin Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Add a new admin filter that allows to show only objects with a blank (or non-blank) field value. Shows three options "all", "blank", "not blank".

This is something I've regularly required and there doesn't seem to be any third party package implementing this, but there are at least a few other people having the need: https://stackoverflow.com/questions/37799694/django-admin-list-filter-filter-field-by-is-empty-none-or-empty-string https://gist.github.com/haplo/2695675 Note that while the filter could easily live in a third party package, I think it makes sense to include it in Django. It's not much code and I guess it's a common requirement.

Change History (4)

comment:2 Changed 4 months ago by Tim Graham

Duplicate of #28687?

comment:3 Changed 4 months ago by Jonas Haag

Not exactly:

Here we're looking at

  • a new filter for
  • blank values
  • of any kind of field (not necessarily relation fields)

#28687 is looking at

  • an extension of an existing filter
  • of null values
  • that deals with relation fields
Last edited 4 months ago by Jonas Haag (previous) (diff)

comment:4 Changed 3 months ago by Tim Graham

Needs documentation: set
Summary: Add new BlankFieldListFilter admin filterAdd an admin filter with choices "all", "blank", "not blank"
Triage Stage: UnreviewedAccepted
Note: See TracTickets for help on using tickets.
Back to Top