Hi, Here's my code:
class Country(models.Model): .... class Organisation(models.Model): country = models.ForeignKey(Country, db_index=True) .... Then, in a views, I select a number of organisations: orgs = Organisation.objects.filter(blabla=something) Now, I'd like to get the number of countries concerned by those organisations I've selected. How is that possible? Although the following code is wrong, is there a similar easy way to achieve that? country_count = orgs.country_set.all().distinct().count() Thanks a lot! Julien --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---