Opened 10 years ago

Closed 10 years ago

#21999 closed New feature (wontfix)

have filter_horizontal / filter_vertical work with ForeignKey

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

Description

When you have many values for a ForeignKey the ability to filter it comes very handy.

From a quick look at the code this is what is required:

  • update contrib/admin/checks.py, contrib/admin/validation.py, contrib/admin/options.py to permit filter_* on ForeignKeys
  • make FilteredSelectMultiple accept a max_entries limit so that a ForeignKey is limited to 1 filtered entry but a ManyToMany may have any limit > 1
  • have the javascript work accordingly with the aforementioned limit

Change History (1)

comment:1 by Tim Graham, 10 years ago

Resolution: wontfix
Status: newclosed

Thanks for the suggestion, but I think it's better to use raw_id_fields which is already designed for ForeignKey.

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