Admin search field for inlines in foreign key relationships

11 views
Skip to first unread message

Raphaël

unread,
Apr 16, 2018, 9:29:27 PM4/16/18
to Django users
Hi,

I have two models, say Boxes and Widgets, using a Foreign Key field on Widgets to link them to Boxes.

A couple years ago, when I first started this project, I used this StackOverflow post to create a multi-select input so an administrator could easily add Widgets to Boxes.

The Widgets, however, are synchronized from an external provider. Recently we suddenly got ~60,000 Widgets added to the database, which makes the ModelMultipleChoiceField unusable, but it would still be ideal to be able to quickly add Widgets from the Box edit page.

What's the recommended way to do this? I was hoping that in the years since, perhaps a "search" field, similar to the one provided with raw_id_fields would have been added to the Admin's "Inline" system (hit search, find the record, have it added to the inlines before saving), but I haven't come across anything in my searches. Is there anything like that on the horizon, or are there any other simple ways to get this done? Or should we stick to searching through the Widgets and changing their boxes individually?

Thanks!
Reply all
Reply to author
Forward
0 new messages