summaryrefslogtreecommitdiff
path: root/tests/model_forms/tests.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-06-18 10:33:37 -0400
committerGitHub <noreply@github.com>2016-06-18 10:33:37 -0400
commit26d0023cccd08473b0acc90e6f06bf3e93ebd847 (patch)
treef4486661b0e5dda5804945b3bc5e880384acd398 /tests/model_forms/tests.py
parentf7a363ee1d2039824d95f35e54219e09c5af67b0 (diff)
Refs #15667 -- Fixed crash when indexing RadioFieldRenderer with ModelChoiceIterator.
Regression in 86573861a95e5a47dc7ff906443117d75b73dca1
Diffstat (limited to 'tests/model_forms/tests.py')
-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 74ea1ad434..fce0656870 100644
--- a/tests/model_forms/tests.py
+++ b/tests/model_forms/tests.py
@@ -1593,6 +1593,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>'
+ )
+
def test_modelchoicefield_iterator(self):
"""
Iterator defaults to ModelChoiceIterator and can be overridden with