Query exclude via model_set property?

22 views
Skip to first unread message

Joshua Russo

unread,
Nov 12, 2011, 2:41:45 PM11/12/11
to django...@googlegroups.com
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?

Joshua Russo

unread,
Nov 12, 2011, 3:20:43 PM11/12/11
to django...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages