I am trying to create a dymanic MultipleChoiceField with the
CheckboxSelectMultiple widget. The thing I want different, is the all
the list for the Choice field I want to be references to that object.
c = Model1.objects.get(id=temp_id)
i = [ ['-','-']]
for x in c.m2mModel2.all():
i.append([x,x])
dynamicForm.base_fields['dynamic_choice'].choices = i[1:]
#....
form = dynamicForm()
That works OK and creates the list and displays it with the list of
many to many with checkboxes. But they are all as one field.
What i though is to have each of the options be a reference to Model2
from the many 2 many fields. So i could display more info from
Model2.
The first solution I though of was {% for x in form.dynamic_choice %}
but it returns 'BoundField' object is not iterable.
Basically do a MultipleChoiceField with a m2m and each option be one
of those objects.
Any idea how I could?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---