mrts / django-admin-list-filter-dropdown

Use dropdowns in Django admin list filter
MIT License
315 stars 48 forks source link

For CharField with choices, the filter shows the "short name" of the choice instead of the verbose name #9

Closed jcmcken closed 5 years ago

jcmcken commented 6 years ago

In the default Django filter, the verbose name is shown when a CharField filter has choices. When I enable your filter classes, I only get the short name, which isn't really recognizable or useful for filtering.

mrts commented 6 years ago

Hm, I haven't tried that myself. What version of Django are you using?

jcmcken commented 6 years ago
>>> import django
>>> django.__version__
'2.0.4'

Typically if somefield is the field, you would use the get_somefield_display helper method that Django provides, which automatically converts the short form of the choice to the long form

mrts commented 6 years ago

Are you using ChoiceDropdownFilter?

In case you are and it still does not work:

My assumption would be that {{ choice.display }} will take care of this in the template layer as that's what Django's admin and FeinCMS use. But perhaps things have changed. Do you care to investigate this a bit? If yes, take a look at the following:

mrts commented 5 years ago

@jcmcken, assuming you were not using ChoiceDropdowFilter, closing. Please feel free to reopen if this is not the case.