I have a 3 table solution
class Organization(models.Model):
name = models.CharField("Organization's name", max_length=100)
class OrganizationDepartment(models.Model):
organization = models.ForeignKey(Organization)
name = models.CharField("Name", max_length=100)
contacts = models.ManyToManyField("Contact")
class Contact(models.Model):
organization = models.ForeignKey("Organization", blank=True, null=True)
name = models.CharField("Contact's name", max_length=100)
I want to create a list of contacts within an organization and not in a given department. The problem is that it looks like I can't use the contact.organzationdepartment_set in an exclude. Is that correct?