logo       

Re: annotations only in 1.1 ?: msg#02282

DjangoUsers

Subject: Re: annotations only in 1.1 ?


thx

(how stupid I am :-))

On 31. Júl, 14:17 h., Daniel Roseman <dan...@xxxxxxxxxxxxxx> wrote:
> On Jul 31, 12:54 pm, gentlestone <tibor.b...@xxxxxxxxxxx> wrote:
>
> > I want find all instances of model KeyWord, where ManyToMany field
> > categories is empty. I think in versieon 1.1 is the appropriate code
> > like this:
>
> > ... KeyWord.objects.annotate(cnt = Count(categories)).filter(cnt =
> > 0) ...
>
> > What is the similar code in old version 1.0 for resolve the same
> > result. Should I use extra() method and go to the table level
> > (SELECT ...) ?
>
> You don't need annotations for this at all.
>
>     KeyWord.objects.filter(category__isnull=True)
>
> --
> 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@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
django-users+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise