-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
status:UnconfirmedIssue, usually a bug, that has not yet been validated as a confirmed problem.Issue, usually a bug, that has not yet been validated as a confirmed problem.type:BugSomething isn't workingSomething isn't working
Description
Issue Summary
When using model admin, if you have search_fields, and one of the fields is a foreign key, it raises the subject error:
Unsupported lookup 'icontains' for ForeignKey or join on the field not permitted.
Steps to Reproduce
- Add FieldPanels to a Django model that has at least one foreignkey:
- Add wagtail_hooks.py or edit it. Add search_fields and include the foreign key.
- Make sure the wagtail_hooks are referenced as ModelAdmin or ModelAdminGroup.
- Go to your website to the admin section for that model
- Add 'something' to the "search" box and click the search button.
- Witness the error
Any other relevant information. For example, why do you consider this a bug and what did you expect to happen instead?
Because it should be warned or considered in Wagtail, or consider in documentation how to refer to the foreign key str representation or an attribute of the foreign key.
- I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: (yes / no) No.
Technical details
- Python version: Run
python --version
. 3.11.3 - Django version: Look in your requirements.txt, or run
pip show django | grep Version
. 4.2.1 - Wagtail version: Look at the bottom of the Settings menu in the Wagtail admin, or run
pip show wagtail | grep Version:
. 5.0 - Browser version: You can use https://www.whatsmybrowser.org/ to find this out. Edge 113 https://www.whatsmybrowser.org/b/DP3T5
Metadata
Metadata
Assignees
Labels
status:UnconfirmedIssue, usually a bug, that has not yet been validated as a confirmed problem.Issue, usually a bug, that has not yet been validated as a confirmed problem.type:BugSomething isn't workingSomething isn't working