Thanks a lot Anler, that's exactly what I want. I never knew that it was so simple.
Thanks and Regards, Swaroop Shankar V On Sun, Jan 8, 2012 at 4:36 PM, Anler <anle...@gmail.com> wrote: > Oh sorry, it should be this: > > photos = Photos.objects.filter(user__groups__id=the_group_id) > > -- > Anler > Sent with Sparrow <http://www.sparrowmailapp.com/?sig> > > On Sunday, January 8, 2012 at 12:04 PM, Anler wrote: > > Swaroop I think this is what you're asking for: > > photos = Photos.objects.filter(user__groups__name='admin') > > -- > Anler > Sent with Sparrow <http://www.sparrowmailapp.com/?sig> > > On Sunday, January 8, 2012 at 11:42 AM, Jonas Geiregat wrote: > > > > Thanks Jonas, the statements you had provided would give me a list of > users who belong that group, but how can I retrieve the photos of those > users? Actually I was looking for a single statement which would join all > these tables and returns the data based on the Group ID. > > > I would recommend reading through > https://docs.djangoproject.com/en/dev/topics/db/queries/ > > Getting a row by ID: > > Group.objects.get(pk=group_id) > > -- > 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. > > > > -- > 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. > -- 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.