mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Refs #15667 -- Fixed crash when indexing RadioFieldRenderer with ModelChoiceIterator.
Regression in 86573861a9
This commit is contained in:
parent
f7a363ee1d
commit
26d0023ccc
2 changed files with 8 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue