Opened 6 years ago

Closed 6 years ago

#18571 closed Bug (wontfix)

ModelAdmin.filter_horizontal should use plural for ManyToManyField

Reported by: Roy Smith Owned by: nobody
Component: contrib.admin Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Do something like:

class Regatta(Model):
    boat = ManyToManyField(Boat, blank=True)

class RegattaAdmin(admin.ModelAdmin):
    filter_horizontal = ['boat']

then edit a Regatta in the admin. The picker boxes will have headers "Available Boat" and "Chosen Boat". These should be plural (i.e. "Available Boats", "Chosen Boats"). Likewise for the mouseover help texts.

Change History (2)

comment:1 Changed 6 years ago by Simon Charette

Semantically speaking I think you should rename your Regatta.boat field to

In this case the admin accounts you are already providing a plural name since it represents a M2M relation.

comment:2 Changed 6 years ago by Roy Smith

Resolution: wontfix
Status: newclosed

Hmmm. I generally follow the rule that all model names are singular, but I see in the docs it is recommended for django that ManyToMany relationships have plural names ( I'm not sure I agree with that recommendation, but since it is the documented standard, I'll go with it.

Marking this "wontfix".

Last edited 6 years ago by Roy Smith (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top