Try target_name_name__icontains='foo' or update the foreign key definition.
On Wed, Jan 29, 2014 at 5:08 PM, Larry Martell <[email protected]>wrote: > I have a table that has these 2 foreign keys: > > target_name = models.ForeignKey(Target) > wafer = models.ForeignKey(Wafer) > > Both Target and Wafer are defined the same: > > name = models.CharField(max_length=40, db_index=True, unique=True) > > When filtering by wafer I can do this: > > wafer__name__icontains='foo' > > But when I try to do the same with target, if I do this: > > target__name__icontains='foo' > > I get: > > FieldError Cannot resolve keyword 'target' into field. And in the > choices it shows: > > target_name > > And if I do: > > target_name__icontains='foo' > > I get: > > Related Field has invalid lookup: icontains > > How can I do foreign key filtering using icontains on this field? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CACwCsY6%3DAOjhYssUYWNQDk-txNvZTfv4RQOZeCSd%2Bb1qQ0NvSA%40mail.gmail.com > . > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK8f%2Bfr2DPpqwh7j4HBZ8ia-YfmpYTTduLzKqbTeNnvz%3DDKd5g%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.

