Code

Opened 5 months ago

Closed 5 months ago

#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

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

Attachments (0)

Change History (1)

comment:1 Changed 5 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.

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.