The question about aggregates still stands -- however, if anybody is wondering about finding all childless parents, I figured a way:
On Monday 03 August 2009 17:45:18 Shai Berger wrote: > > class Team(models.Model): > name = models.CharField(max_length=100) > > class Player(moedls.Model): > name = models.CharField(max_length=100) > team = models.ForeignKey(Team) > > Now, I want to perform some operation on all the empty teams -- so I want > to do something like > > Team.objects.annotate(num_players=Count('player_set')).filter(num_players__ >eq=0) > team_players = Player.objects.all().values('team').query Team.objects.exclude(pk__in=team_players).... Have fun, Shai. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---