#21999 closed New feature (wontfix)

have filter_horizontal / filter_vertical work with ForeignKey

Reported by: rm_ Owned by: nobody
Component: contrib.admin Version: master
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


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 Changed 21 months ago by timo

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

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