summaryrefslogtreecommitdiff
path: root/tests/model_forms
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-06-18 10:33:37 -0400
committerTim Graham <timograham@gmail.com>2016-06-18 10:37:37 -0400
commit1213ef2b182261ee690eba484ac7a929ff4707c9 (patch)
treeae47d33e53f45a5652b8d22ec45da5e3c751e0a7 /tests/model_forms
parentbdc29b7188af0cda31a2e37759236d06d996eb44 (diff)
[1.10.x] Refs #15667 -- Fixed crash when indexing RadioFieldRenderer with ModelChoiceIterator.
Regression in 86573861a95e5a47dc7ff906443117d75b73dca1
Diffstat (limited to 'tests/model_forms')
-rw-r--r--tests/model_forms/tests.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py
index 37ae5089ae..29472359c2 100644
--- a/tests/model_forms/tests.py
+++ b/tests/model_forms/tests.py
@@ -1573,6 +1573,13 @@ class ModelChoiceFieldTests(TestCase):
with self.assertNumQueries(1):
template.render(Context({'field': field}))
+ def test_modelchoicefield_index_renderer(self):
+ field = forms.ModelChoiceField(Category.objects.all(), widget=forms.RadioSelect)
+ self.assertEqual(
+ str(field.widget.get_renderer('foo', [])[0]),
+ '<label><input name="foo" type="radio" value="" /> ---------</label>'
+ )
+
class ModelMultipleChoiceFieldTests(TestCase):
def setUp(self):