From c0e01416b68e482172ef23cc507f163b873c192a Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Sat, 27 Jan 2007 21:41:32 +0000 Subject: Fixed #3312 -- CheckboxSelectMultiple no longer uses duplicate ID attributes for each checkbox git-svn-id: http://code.djangoproject.com/svn/django/trunk@4436 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/forms/tests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/regressiontests/forms') diff --git a/tests/regressiontests/forms/tests.py b/tests/regressiontests/forms/tests.py index 328582d162..f60898c179 100644 --- a/tests/regressiontests/forms/tests.py +++ b/tests/regressiontests/forms/tests.py @@ -2149,6 +2149,16 @@ MultipleChoiceField can also be used with the CheckboxSelectMultiple widget.
  • +Regarding auto_id, CheckboxSelectMultiple is a special case. Each checkbox +gets a distinct ID, formed by appending an underscore plus the checkbox's +zero-based index. +>>> f = SongForm(auto_id='%s_id') +>>> print f['composers'] + + Data for a MultipleChoiceField should be a list. QueryDict and MultiValueDict conveniently work with this. >>> data = {'name': 'Yesterday', 'composers': ['J', 'P']} -- cgit v1.3