pavi
pavi

Reputation: 11

How to add a filter/search option to a foreign key dropdown in Wagtail admin?

I have a Django foreign key field in my Wagtail admin panel that references the Faculty model. However, when selecting a faculty for a course, the dropdown list does not provide a search or filter option.

Current code:

faculty = models.ForeignKey("Faculty", on_delete=models.CASCADE, related_name="courses") FieldPanel("faculty"),

This generates a basic dropdown list in the Wagtail admin panelbasic, but I need a searchable dropdown like this: need like this

What I need

A filter/search feature in the dropdown list when selecting a faculty in Wagtail admin.

Preferably a select2-style search box or any built-in Wagtail solution.

What I tried:

I looked into using FieldPanel, but I’m not sure how to make it searchable. Should I use AutocompletePanel, or is there another approach?

Any help would be appreciated!

Upvotes: 1

Views: 16

Answers (0)

Related Questions