Opened 5 years ago
Closed 4 years ago
#31636 closed Bug (fixed)
BooleanFieldListFilter doesn't respect field choices.
Reported by: | Maxence G | Owned by: | Manav Agarwal |
---|---|---|---|
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: | yes | UI/UX: | no |
Description
If I have such construction:
# models.py class BoolTest(models.Model): BOUGHT_CHOICES = ( (False, 'Pending'), (True, 'Bought') ) bought = models.BooleanField( verbose_name="Fancy Boolean", default=False, choices=BOUGHT_CHOICES) # admin.py class BoolTestAdmin(admin.ModelAdmin): list_filter = ('bought',) admin.site.register(BoolTest, BoolTestAdmin)
The boolean Filter text is not modified to fit choices param
Example (in FR):
FILTRE
Par Fancy Boolean
- Tout
- Oui
- Non
Should be :
FILTRE
Par Fancy Boolean
- Tout
- Bought
- Pending
Change History (9)
comment:1 by , 5 years ago
Summary: | Django Bool choices text and admin filter → BooleanFieldListFilter doesn't respect field choices. |
---|---|
Triage Stage: | Unreviewed → Accepted |
Version: | 3.0 → master |
comment:2 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 4 years ago
Owner: | changed from | to
---|
comment:8 by , 4 years ago
Patch needs improvement: | set |
---|
comment:9 by , 4 years ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Note:
See TracTickets
for help on using tickets.
Thanks, we could probably use
field.flatchoices
, e.g.