I am creating a view to edit a model that has a ManyToMany field.
The field is defined as:

performer = models.ManyToManyField(Entity, limit_choices_to=
{'role__exact':'PER'})

Entity is a table of persons or organizations.   Some of them are
performers and some are not (distinguished by "role").

I create a form from a valid instance of the model in the usual way
using modelform. The correct set of POSSIBLE performers is shown but
the ACTUAL performers are not highlighted (none are highlighted).
So if the form is submitted with no changes it causes an error since
performers is a required field.

If I remove limit_choices_to, the set of entities shown is not correct
(includes non-performers) but the performers currently saved in the
instance ARE correctly highlighted.

This seems like a bug but perhaps I have misunderstood what is
supposed to happen.    And is there a workaround?

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