Hi all, With the new aggregates in django 1.1, I wonder if there's an easy way to aggregate over reverse relationships. As an example, assume a simplistic representation of a set of teams:
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) There may be some obvious way (which I'm currently missing) to solve the specific problem of finding the empty teams without such aggregates; however, they do make sense in general. Is there a way? Thanks, 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 -~----------~----~----~----~------~----~------~--~---