Opened 5 years ago

Closed 5 years ago

#15971 closed Bug (fixed)

The titles of admin list_filters aren't translated anymore

Reported by: mk Owned by: nobody
Component: contrib.admin Version: master
Severity: Release blocker 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:


FieldListFilter.title is not initialized with verbose_name of fields anymore but with field_path instead. Because of this the admin change_list shows 'Nach status' and 'Nach visitor_name' instead of 'Nach Status' and 'Nach Besucher'.

Attachments (2)

15971.diff (4.6 KB) - added by mk 5 years ago.
15971.admin-filter-verbose-name.diff (4.7 KB) - added by julien 5 years ago.

Download all attachments as: .zip

Change History (11)

Changed 5 years ago by mk

comment:1 Changed 5 years ago by mk

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

The attached patch probably needs improvement, but I'll leave that to someone else.

I think the tests are verifying the wrong behavior here, too.

comment:2 Changed 5 years ago by jezdez

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 5 years ago by dmclain

  • Resolution set to duplicate
  • Status changed from new to closed

This looks like a duplicate of #15221

Changed 5 years ago by julien

comment:4 Changed 5 years ago by julien

  • Resolution duplicate deleted
  • Severity changed from Normal to Release blocker
  • Status changed from closed to reopened

#15221 is a related, but different issue. #15221 is for displaying the _RelatedFieldListFilter_'s title properly.

But thanks, I was just going to point to it :-)

This ticket here is a regression (whereas the issue in #15221 has always been there), hence marking as blocker. The attached patch checks for the existence of a verbose_name attribute, similar to the approach in the patch for #15221 (which I'm also going to update in a minute).

comment:5 Changed 5 years ago by mk

I don't think the patch fixes the whole issue. We should be able to display a proper verbose_name even for related objects (to support something like list_filter = ('related__object__attribute',)

Or am I misunderstanding something?

comment:6 Changed 5 years ago by julien

@mk: Agreed, which is what #15221 is suggesting. However, the patch here addresses the regression only, which is a slightly different issue.

FieldListFilter, as a super class, should avoid trying to guess about its child classes' business. The best it can do is provide a sensible default (i.e. verbose_name if possible, or field_path if not). The patch in #15221 lets RelatedFieldListFilter (i.e. the child class) override this default behaviour.

Again, this ticket is about fixing a regression that was introduced by [16144]. #15221 is about fixing a behaviour that has always existed.

Hope that makes sense :-)

comment:7 Changed 5 years ago by mk

Ah yes, indeed. I was mislead by my own stupid patch.


comment:8 Changed 5 years ago by jezdez

  • Triage Stage changed from Accepted to Ready for checkin

comment:9 Changed 5 years ago by jezdez

  • Resolution set to fixed
  • Status changed from reopened to closed

In [16171]:

Fixed #15971 -- Fixed regression introduced in r16144 that prevented the use of the field's verbose_name attribute. Thanks to mk and Julien.

Note: See TracTickets for help on using tickets.
Back to Top