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
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... :)
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
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
4 matches
Mail list logo