Ok, I tried

search_fields = ['school__lawyer_first']

and I get this error

Cannot resolve keyword 'lawyer_first' into field. Choices are: id,
lawyer, school

In the variations that I tried only

search_fields = ['school__school']

worked.

I followed the tutorial and arranged lawyer names as a list, so that
when I search for school, I see which lawyers went to that school and
their year of graduation. Then I have the filter by year, and when I
apply that filter, I see all the lawyers who graduated from same
school same year. This is the result that I want, but obviously not a
very elegant solution.

Thank you.

On Nov 11, 1:01 pm, "pjrhar...@gmail.com" <pjrhar...@gmail.com> wrote:
> > I tried
>
> > search_fields = ['school__lawyer']
>
> > but I get an error message when I did a search for last name of
> > lawyer:
>
> > Related Field has invalid lookup: icontains
>
> You need something like:
>
> search_fields = ['school__lawyer_last']
>
> to specify which field on the related 'lawyer' instance you want to
> search. You can add others like:
>
> search_fields = ['school__lawyer_last', 'school__lawyer_first']
>
> Peter
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to