On Thursday, February 17, 2011 10:06:40 PM UTC, Margie Roginski wrote: > > Thanks for your reply, Daniel. I didn't give my example specifically > enough. In my particular case I actually have a handle to the Person > and actually don't need all the join dates for all the people in that > group. I just need that person's join date. > > I can see that it is easy to get all membership info for a given > group, but I'm guessing that my original solution is the appropriate > solution for getting the join date for just a single person? > > Margie
No, because you're doing a lot of extra selecting and iterating that you don't need to. You can still do it in a single go: Membership.objects.get(person=person, group__name='beatles').join_date I often find that apparently difficult queries become a lot simpler if you approach them from the other direction - from the Membership rather than the Group, in this instance. -- DR. -- 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.