Hello list
I have a question. I need to build a multi-level MultipleChoiceField.
Something like this:
-------------------------------
<select>
<optgroup label="Videogames">
<optgroup label="PS3">
<option value="1">Heavy Rain</option>
<option value="2">KOF XIII</option>
</optgroup>
<optgroup label="XBox">
<option value="3">Halo 3</option>
</optgroup>
</optgroup>
<optgroup label="Comics">
<optgroup label="DC">
<option value="4">Watchmen</option>
<option value="5">Swamp thing</option>
</optgroup>
<optgroup label="Marvel">
<option value="6">Spiderman</option>
</optgroup>
</optgroup>
</select>
-------------------------------
With just one level (1 optgroup) is easy, but optgroups inside other
optgroups ... I don't know how.
I'm trying this:
------------------
myChoices= (
('Videogames', (
('PS3', (
('1', 'Heavy Rain'),
('2', 'KOF XIII')
)),
('XBox', (
('3', 'Halo 3')
))
),
),
('Comics', (
('DC', (
('4', 'Watchmen'),
('5', 'Swamp thing')
)),
('Marvel', (
('6', 'Spiderman')
))
)
)
)
......
self.fields['myList'].choices= self.myChoices
------------------------------
But don't works
Somebody have an idea?
That's all. Bye
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/oQ5CNP_841cJ.
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.