Add these three fields to the class defined in the adminx.py file
list_display = ['code','email','send_type','send_time'] # the type of fields to display
search_fields = ['code','email','send_type'] # fields to search (all fields together) No fields with foreign keys here
list_filter = ['code','email','send_type','send_time'] # fields searched (single field search) and time
1.Problem description
When using xadmin to realize Django background function, use search_ Fields = [field name, field name], related field got invalid lookup: icons
2.Problem analysis
search_ Fields controls the name of the field that can be searched through the search box_ Fields = () or search_ Fields = [], xadmin uses fuzzy query
The search of related fields is invalid because search_ For example, if the field type is ForeignKey, an error will be reported
3.Solutions
Delete search_ Fields, for example, delete the field type ForeignKey
Similar Posts:
- [Solved] Django use search_fields error (in get_lookup_constraint)
- How to Solve Django xadmin installation Error [7 Types of Errors]
- Python TypeError: __init__() missing 1 required positional argument: ‘on_delete’
- Error: Unknown column ‘*_image_url’ in ‘field list’ [How to Solve]
- [Solved] must appear in the GROUP BY clause or be used in an aggregate function
- ES Error:”illegal_argument_exception” [How to Solve]
- SpringMVC @RequestBody Error:Unrecognized field, not marked as ignorable
- Uncaught SyntaxError: Unexpected end of JSON input [How to Solve]
- org.hibernate.QueryException: could not resolve property
- MySQL Error Number 1005 Can’t create table (Errno:150)