Code

Opened 3 years ago

Closed 3 years ago

#16711 closed Bug (duplicate)

RelatedFieldListFilter and filter title

Reported by: dan.klasson@… Owned by: nobody
Component: contrib.admin Version: master
Severity: Normal Keywords:
Cc: dan.klasson@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The class RelatedFieldListFilter in /django-trunk/django/contrib/admin/filters.py has a bug in it.

If I have this model and admin class:

class SomeModel(models.Model):
    deposit = models.ManyToManyField(PaymentMethod, related_name="deposit")
    withdrawal = models.ManyToManyField(PaymentMethod, related_name="withdrawal")

class SomeModelAdmin(admin.ModelAdmin):
    list_filter('deposit', 'withdrawal')

I expect the filter name/title of 'deposit' and 'withdrawal' on the listing page to be "By Deposit" and "By Withdrawal". And not "By Payment Method".

Line 151 should be:

if not isinstance(field, (models.ManyToManyField,

Instead of:

if isinstance(field, (models.ManyToManyField,

Attachments (0)

Change History (1)

comment:1 Changed 3 years ago by julien

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

This is a duplicate of #15221.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.