use two underscores to address the other table/model

institution_institution

vs

institution__institution



django querysets rock !




On Tue, Mar 3, 2009 at 10:19 PM, Jesse <adles...@gmail.com> wrote:

>
> I tried that option and received this error:
>
> Cannot resolve keyword 'institution_institution' into field
>
> However, I think I may have it.  I used this statement:
>
>       qset2 = (
>           Q(institution__icontains=queryr)
>        )
>        resultsi = Institution.objects.filter(qset2).distinct()
>         for id in resultsi:
>            resultsii=Researchproject.objects.filter(institution=id)
>
> And am able to get the results in the template.  It just makes for
> more coding, however, in the view.  It would be easier to have all the
> code in the qset and not have to add another qset2.
>
> On Mar 3, 1:01 pm, Tim <timster...@gmail.com> wrote:
> > If you want to look up an Institution using the Project model, you
> > should be able to use "institution__institution__icontains"
> >
>

--~--~---------~--~----~------------~-------~--~----~
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