diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2016-02-23 15:39:20 -0800 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-02-24 07:02:51 -0500 |
| commit | b41268135995cef46d40e550f9301fab20cf330d (patch) | |
| tree | 063e280d5debf94c734de62bfe048fa6f05e7244 /tests/forms_tests | |
| parent | 1ff6e37de46f0cbf271a287a0ca67678e741a90a (diff) | |
Fixed #26267 -- Fixed BoundField to reallow slices of subwidgets.
Diffstat (limited to 'tests/forms_tests')
| -rw-r--r-- | tests/forms_tests/tests/test_forms.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py index 17703f2d23..22675bb84b 100644 --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -661,6 +661,20 @@ class FormsTestCase(SimpleTestCase): f = BeatleForm(auto_id=False) self.assertHTMLEqual('\n'.join(str(bf) for bf in f['name']), '<input type="text" name="name" />') + def test_boundfield_slice(self): + class BeatleForm(Form): + name = ChoiceField( + choices=[('john', 'John'), ('paul', 'Paul'), ('george', 'George'), ('ringo', 'Ringo')], + widget=RadioSelect, + ) + + f = BeatleForm() + bf = f['name'] + self.assertEqual( + [str(item) for item in bf[1:]], + [str(bf[1]), str(bf[2]), str(bf[3])], + ) + def test_forms_with_multiple_choice(self): # MultipleChoiceField is a special case, as its data is required to be a list: class SongForm(Form): |
