Re: A Query question about Many-to-many relationships

2010-02-22 Thread Jason
Hi Atamert, Thank you so much! The following statement works! This is really simple but fantastic!!! Publication.objects.filter(article__in = article_qs).annotate(Count('article')) Sincerely, Jason -- You received this message because you are subscribed to the Google Groups "Django users" gro

Re: A Query question about Many-to-many relationships

2010-02-22 Thread Atamert Ölçgen
Hi Jason, On Monday 22 February 2010 09:57:18 Jason wrote: > If I already had a QuerySet of Article named articles, how to get a > QuerySet of Publication by these articles, You can use field lookup operator `in` like this: >>> Publication.objects.filter( >>> article_set__id__in = article_qs