I was trying to use limit_choices_to in what I thought was an intuitive
way.

class Organization(models.Model):
    members = ManyToManyField(User)

class Committee(models.Model):
    org = ForeignKey(Organization)
    chair = ForeignKey(
            User,
            limit_choices_to={ 'organization_set__contains' : org })

What I want to do is limit the choices for the chair to only people who
are members of the organization. (What I realize now is that the
CONTAINS clause appears in the actual SQL WHERE clause and is trying to
do a text match, so I see why it doesn't work.)

Is there an easy and natural way to do this with the database API?

Thanks,
Todd


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to