Opened 14 years ago

Closed 14 years ago

#15971 closed Bug (fixed)

The titles of admin list_filters aren't translated anymore

Reported by: Matthias Kestenholz Owned by: nobody
Component: contrib.admin Version: dev
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: no

Description

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 Matthias Kestenholz 14 years ago.
15971.admin-filter-verbose-name.diff (4.7 KB ) - added by Julien Phalip 14 years ago.

Download all attachments as: .zip

Change History (11)

by Matthias Kestenholz, 14 years ago

Attachment: 15971.diff added

comment:1 by Matthias Kestenholz, 14 years ago

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 by Jannis Leidel, 14 years ago

Triage Stage: UnreviewedAccepted

comment:3 by dmclain, 14 years ago

Resolution: duplicate
Status: newclosed

This looks like a duplicate of #15221

by Julien Phalip, 14 years ago

comment:4 by Julien Phalip, 14 years ago

Resolution: duplicate
Severity: NormalRelease blocker
Status: closedreopened

#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 by Matthias Kestenholz, 14 years ago

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 by Julien Phalip, 14 years ago

@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 by Matthias Kestenholz, 14 years ago

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

Thanks!

comment:8 by Jannis Leidel, 14 years ago

Triage Stage: AcceptedReady for checkin

comment:9 by Jannis Leidel, 14 years ago

Resolution: fixed
Status: reopenedclosed

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