Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Textual search for ForeignKey field in Django Admin

I apologize if this question has already been answered, but I couldn't find it anywhere else.

In my django project, I have foreignkey fields which have hundreads of options for selection. The django dropdown default widget for foreignkey fields makes it really difficult to find the one I want.

I have crossed with the filter_horizontal admin option, which brings great selection functionality for many to many fields with a textual search field and two selectors.

I was wondering if there is a django built-in option or if any of you has found a solution that allows me do a textual search "on-the-fly" for foreignkey fields as in many to many fields specified in "filter_horizontal"

Thanks in advance.

like image 935
Francisco Avatar asked Nov 14 '22 13:11

Francisco


1 Answers

Check out raw_id_fields

like image 110
Paul Du Bois Avatar answered Dec 10 '22 06:12

Paul Du Bois