>>> f = SongForm({'composers': ['J']}, auto_id=False)
>>> print f['composers']
-
-
+
+
>>> f = SongForm({'composers': ['J', 'P']}, auto_id=False)
>>> print f['composers']
-
-
+
+
Regarding auto_id, CheckboxSelectMultiple is a special case. Each checkbox
@@ -516,8 +516,8 @@
>>> f = SongForm(auto_id='%s_id')
>>> print f['composers']
-
-
+
+
Data for a MultipleChoiceField should be a list. QueryDict and MultiValueDict
Index: tests/regressiontests/forms/widgets.py
===================================================================
--- tests/regressiontests/forms/widgets.py (revision 6862)
+++ tests/regressiontests/forms/widgets.py (working copy)
@@ -762,71 +762,71 @@
>>> w = CheckboxSelectMultiple()
>>> print w.render('beatles', ['J'], choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
If the value is None, none of the options are selected:
>>> print w.render('beatles', None, choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
-
-
-
-
+
+
+
+
If the value corresponds to a label (but not to an option value), none of the options are selected:
>>> print w.render('beatles', ['John'], choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
-
-
-
-
+
+
+
+
If multiple values are given, but some of them are not valid, the valid ones are selected:
>>> print w.render('beatles', ['J', 'G', 'foo'], choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
-
-
-
-
+
+
+
+
The value is compared to its str():
>>> print w.render('nums', [2], choices=[('1', '1'), ('2', '2'), ('3', '3')])
The 'choices' argument can be any iterable:
@@ -835,45 +835,45 @@
... yield (i, i)
>>> print w.render('nums', [2], choices=get_choices())
-
-
-
-
-
+
+
+
+
+
You can also pass 'choices' to the constructor:
>>> w = CheckboxSelectMultiple(choices=[(1, 1), (2, 2), (3, 3)])
>>> print w.render('nums', [2])
-
-
-
+
+
+
If 'choices' is passed to both the constructor and render(), then they'll both be in the output:
>>> print w.render('nums', [2], choices=[(4, 4), (5, 5)])