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!
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!
Share Improve this question asked Mar 3 at 2:25 pavipavi 131 silver badge2 bronze badges1 Answer
Reset to default 1If you register your Faculty model as a snippet, FieldPanel will load the Snippet Chooser, which has a search box. You can then tweak the search by specifying the search fields and autocomplete fields for the Faculty model.
This is how the chooser looks like:
See Registering snippets and Making snippets searchable
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745112193a4611913.html
评论列表(0条)