Opened 12 years ago

Closed 12 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

Description

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 by Simon Charette, 12 years ago

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

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

comment:2 by Roy Smith, 12 years ago

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 (https://docs.djangoproject.com/en/dev/topics/db/models/#many-to-many-relationships). 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 12 years ago by Roy Smith (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top