1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #15667 -- Added template-based widget rendering.

Thanks Carl Meyer and Tim Graham for contributing to the patch.
This commit is contained in:
Preston Timmons
2016-12-27 17:00:56 -05:00
committed by Tim Graham
parent 51cde873d9
commit b52c73008a
98 changed files with 1334 additions and 874 deletions

View File

@@ -1651,13 +1651,6 @@ 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_disabled_modelchoicefield(self):
class ModelChoiceForm(forms.ModelForm):
author = forms.ModelChoiceField(Author.objects.all(), disabled=True)
@@ -2115,7 +2108,7 @@ class FileAndImageFieldTests(TestCase):
doc = Document.objects.create()
form = DocumentForm(instance=doc)
self.assertEqual(
self.assertHTMLEqual(
str(form['myfile']),
'<input id="id_myfile" name="myfile" type="file" />'
)