On Jul 31, 12:54 pm, gentlestone <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---