Hi,
I have two simple models:
class Country(models.Model):
name = models.CharField(_("Name"), max_length=50,
unique=True)
class Profile(models.Model):
name = models.CharField(_("Name"), max_length=50,
unique=True)
country = models.ForeignKey(Country)
If I want to create a list of all countries that are actually
referenced (i.e. used by at least one Profile entry), how would I code
that in Django?
Maybe something like (of course this is rubbush):
referenced_countries = Country.objects.exclude
(profile__country__isnull=True)
Thanks for your help
Markus
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---