Hello again. I have one more question about the three table lookup I am trying to complete.
The details of my situation are posted here: http://dpaste.com/115244/ Does anybody have any idea on how to use django's ORM to perform two INNER JOINS, a WHERE, and an ORDER BY? Thanks in advance for any help and further guidance! On Thu, Jan 29, 2009 at 4:00 PM, Kyle <thinki...@gmail.com> wrote: > Yes, almost. It got me to understand the correct syntax. > > I noticed that my results were coming according to Industry's primary key, > rather than the Industry integer field, so I appended another __industry > > Here is the solution: > > Project.objects.filter(campaign__industry__industry=x) > > Thank you for your guidance, Todd. > > > On Thu, Jan 29, 2009 at 12:33 PM, Todd O'Bryan <toddobr...@gmail.com>wrote: > >> >> I'm not sure I understand what you're asking, but >> >> projs = Project.objects.filter(campaign__industry=x) >> >> where x is one of 1-6 should do what you want, I think. >> >> Is that what you were asking? >> >> On Thu, Jan 29, 2009 at 9:54 AM, Kyle <thinki...@gmail.com> wrote: >> > >> > Hello! >> > >> > I am trying to get a list of "Projects" based on certain "Industry". >> > (My naming convention, not django's) >> > >> > My models look like this: >> > http://dpaste.com/114308/ >> > >> > "Project" has a foreign key to "Campaign". >> > >> > "Industry" also has a foreign key to "Campaign". >> > >> > Does it matter if both relationships are pointing to the center model >> > in the data route I am trying to setup? Like this: >> > >> > Project -> Campaign <- Industry >> > >> > If Industry = 3, and a handful of Campaigns are returned, I would like >> > a list of all the Projects contained in each of the Campaigns >> > returned. >> > >> > How do I do this with django models? >> > >> > > >> > >> >> >> >> > > > -- > Light Emitter > Think in 3D Studios > www.thinkin3d.net > -- Light Emitter Think in 3D Studios www.thinkin3d.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---