I am trying to set up a model. 

A Person has a ManyToMany relationship with Entities. One of those
relationships is special - we can capture that with a ForeignKey
relationship to Entity.

But, I want to limit the choices for that special relationship to
Entities that the person already has a relationship with, by using a:

   limit_choices_to  = {field: value},


So, I have tried various things that look like this:

class Person(models.Model):
    entities = models.ManyToManyField(
        Entity, 
        related_name = 'people', 
        through ='Membership',
        )
    home_entity = models.ForeignKey(
        Entity, 
        related_name = 'people_home', 
        limit_choices_to  = {'people': person},
        )

but I can't get the limit_choices_to dictionary right (obviously, it's
not going to be literally {'people': person}).

What should I be doing here?

Thanks,

Daniele


--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to