Re: Many to many relation - parents without any children

2009-11-15 Thread Tomasz Zieliński
On 15 Lis, 09:34, Nagy Károly wrote: > Tomasz Zieli ski wrote: > > How about something like this (should work, although I haven't checked > > it): > > > Author.objects.annotate(article_num=Count('articles')).filter > > (article_num=0) > > > - where articles=ManyToManyField('Article') > > This is

Re: Many to many relation - parents without any children

2009-11-15 Thread Nagy Károly
Tomasz Zieliński wrote: > How about something like this (should work, although I haven't checked > it): > > Author.objects.annotate(article_num=Count('articles')).filter > (article_num=0) > > - where articles=ManyToManyField('Article') > This is so elegant, so i have to upgrade to 1.1 now... :)

Re: Many to many relation - parents without any children

2009-11-14 Thread Tomasz Zieliński
On 14 Lis, 23:20, Nagy Károly wrote: > Please help me in orm level filtering many-to-many relations. > > I have to filter all "authors" who does not belongs to any "articles". > Or the opposite of this, list of orphaned articles... > > I dont want to write sql in the model if possible. How abou

Many to many relation - parents without any children

2009-11-14 Thread Nagy Károly
Please help me in orm level filtering many-to-many relations. I have to filter all "authors" who does not belongs to any "articles". Or the opposite of this, list of orphaned articles... I dont want to write sql in the model if possible. Thank you, Charlie. -- You received this message because