Search for a location in admin generates an error: fix is at the bottom below

Issue #1 new
Paul Egges
created an issue

Search generates the following error

File "./lib/python2.5/django/db/models/fields/", line 156, in get_db_prep_lookup raise TypeError, "Related Field has invalid lookup: %s" % lookup_type

TypeError: Related Field has invalid lookup: icontains

Fix the Line 7



search_fields = ['representative', 'street1', 'street2', 'city', 'state', 'postal_code', 'country']


Should be



search_fields = ['representative__name', 'street1', 'street2', 'city', 'state', 'postal_code', 'country']

}}} Because representative is a Foreign Key we need to specify the field(s) in the model to search. In this case the name.

Comments (2)

  1. Log in to comment