diff --git a/django/forms/jinja2/django/forms/widgets/clearable_file_input.html b/django/forms/jinja2/django/forms/widgets/clearable_file_input.html index 93812837f010..4f3a93627f50 100644 --- a/django/forms/jinja2/django/forms/widgets/clearable_file_input.html +++ b/django/forms/jinja2/django/forms/widgets/clearable_file_input.html @@ -1,5 +1,5 @@ {% if widget.is_initial %}{{ widget.initial_text }}: {{ widget.value }}{% if not widget.required %} - + {% endif %}
{{ widget.input_text }}:{% endif %} diff --git a/django/forms/templates/django/forms/widgets/clearable_file_input.html b/django/forms/templates/django/forms/widgets/clearable_file_input.html index 93812837f010..4f3a93627f50 100644 --- a/django/forms/templates/django/forms/widgets/clearable_file_input.html +++ b/django/forms/templates/django/forms/widgets/clearable_file_input.html @@ -1,5 +1,5 @@ {% if widget.is_initial %}{{ widget.initial_text }}: {{ widget.value }}{% if not widget.required %} - + {% endif %}
{{ widget.input_text }}:{% endif %} diff --git a/tests/forms_tests/widget_tests/test_clearablefileinput.py b/tests/forms_tests/widget_tests/test_clearablefileinput.py index 53b84cc0ecfd..ae54cc4b5da9 100644 --- a/tests/forms_tests/widget_tests/test_clearablefileinput.py +++ b/tests/forms_tests/widget_tests/test_clearablefileinput.py @@ -111,6 +111,21 @@ def test_render_disabled(self): ), ) + def test_render_checked(self): + self.widget.checked = True + self.check_html( + self.widget, + "myfile", + FakeFieldFile(), + html=( + 'Currently: something' + '" + '
Change: ' + '' + ), + ) + def test_render_no_disabled(self): class TestForm(Form): clearable_file = FileField(