1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

[1.10.x] Refs #15667 -- Fixed crash when indexing RadioFieldRenderer with ModelChoiceIterator.

Regression in 86573861a9
This commit is contained in:
Tim Graham
2016-06-18 10:33:37 -04:00
parent bdc29b7188
commit 1213ef2b18
2 changed files with 8 additions and 1 deletions

View File

@@ -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):