mirror of
https://github.com/django/django.git
synced 2025-11-25 13:13:28 +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:
parent
51cde873d9
commit
b52c73008a
98 changed files with 1334 additions and 874 deletions
|
|
@ -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" />'
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue