Re: query related question

2010-01-14 Thread Shawn Milochik
On Jan 14, 2010, at 11:53 PM, E. Hakan Duran wrote: > Thanks a lot for the quick response. > > On Thursday 14 January 2010 23:08:43 Shawn Milochik wrote: > >> ... >> woman = Woman.objects.get(lastname__exact = 'Test') >> couple = Couple.objects.get(couple = woman.couple) >> >> Note that this i

Re: query related question

2010-01-14 Thread E. Hakan Duran
Thanks a lot for the quick response. On Thursday 14 January 2010 23:08:43 Shawn Milochik wrote: > ... > woman = Woman.objects.get(lastname__exact = 'Test') > couple = Couple.objects.get(couple = woman.couple) > > Note that this is making the assumption that there is only one woman with > that l

Re: query related question

2010-01-14 Thread Kevin Monceaux
E. Hankan, On Thu, Jan 14, 2010 at 10:53:31PM -0500, E. Hakan Duran wrote: Take the following with a grain, or three, of salt. I'm a little rusty. I converted a web site to Django back in the pre-1.x days and am just getting back to tinkering with Django to enhance the functionality of said sit

Re: query related question

2010-01-14 Thread Shawn Milochik
Your couple_query returns a queryset. Even if there's only one result, you're not getting just the one woman, but a queryset object. I think you want something more like: woman = Woman.objects.get(lastname__exact = 'Test') couple = Couple.objects.get(couple = woman.couple) Note that this is mak

query related question

2010-01-14 Thread E. Hakan Duran
Hi all, I don't have a technical background, so please be gentle with me. I have two models with a ForeignKey relation: "couple" and "woman". I am trying to set up a query that lists the women with lastname='Test' along with some of their information from the "woman" model as well as some from