Fred

FieldError: Related Field got invalid lookup: icontains

django Icon

FieldError

Related Field got invalid lookup: icontains

An unhandled exception occurred
Exception source not available.

Solution

When enable search for a foreign key in the admin, use:
search_fields = ['foreinkeyfield__name']

instead of search_fields = ['foreinkeyfield']            
Mar 20, 2021 Anyone

0 replies


Install the browser extension

Found this solution helpful? Try our extension for quick solutions to your Django errors.

Chrome logo Add to Chrome - It's free