Opened 7 years ago
Closed 5 years ago
#28991 closed New feature (fixed)
Add an admin filter with choices "all", "blank", "not blank"
Reported by: | Jonas Haag | Owned by: | Federico Jaramillo Martínez |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
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 (14)
comment:1 by , 7 years ago
comment:3 by , 7 years ago
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
comment:4 by , 7 years ago
Needs documentation: | set |
---|---|
Summary: | Add new BlankFieldListFilter admin filter → Add an admin filter with choices "all", "blank", "not blank" |
Triage Stage: | Unreviewed → Accepted |
comment:5 by , 6 years ago
Hi,
I tried to rework and improve the original PR with my own PR https://github.com/django/django/pull/10599
(This my first attempt to contribute to Django)
Thanks
comment:6 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:7 by , 6 years ago
Owner: | removed |
---|---|
Status: | assigned → new |
comment:8 by , 6 years ago
Needs documentation: | unset |
---|---|
Patch needs improvement: | set |
Left a few comments for improvements on the PR.
comment:9 by , 6 years ago
Patch needs improvement: | unset |
---|
comment:10 by , 6 years ago
Patch needs improvement: | set |
---|
Commented on PR: Docs need some clarification. Possibly some extra tests needed. (?) Needs updating to target v3.0.
comment:11 by , 5 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:12 by , 5 years ago
Patch needs improvement: | unset |
---|
comment:13 by , 5 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
PR https://github.com/django/django/pull/9546