summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2016-02-23 15:39:20 -0800
committerTim Graham <timograham@gmail.com>2016-02-24 07:03:24 -0500
commit04780e8a25979645effeee0dacc279a8562ce675 (patch)
tree51a79d93e692a4396464913e91e14f5579287108 /tests
parent5ca1d0a654aeb7ad655f565627b5b7eefc23d776 (diff)
[1.9.x] Fixed #26267 -- Fixed BoundField to reallow slices of subwidgets.
Backport of b41268135995cef46d40e550f9301fab20cf330d from master
Diffstat (limited to 'tests')
-rw-r--r--tests/forms_tests/tests/test_forms.py14
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 00d2045786..6492b1eda0 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):