From d4da39685b5974849c73e4c4dc6e07dfdf21c67a Mon Sep 17 00:00:00 2001 From: Roman Selivanov Date: Wed, 19 Jul 2017 18:24:27 +0300 Subject: Fixed #28414 -- Fixed ClearableFileInput rendering as a subwidget of MultiWidget. --- .../forms/jinja2/django/forms/widgets/clearable_file_input.html | 8 ++++---- .../templates/django/forms/widgets/clearable_file_input.html | 8 ++++---- django/forms/widgets.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'django/forms') 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 05f2c2dbe5..7248f32d2a 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 is_initial %}{{ initial_text }}: {{ widget.value }}{% if not widget.required %} - -{% endif %}
-{{ input_text }}:{% endif %} +{% 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 05f2c2dbe5..7248f32d2a 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 is_initial %}{{ initial_text }}: {{ widget.value }}{% if not widget.required %} - -{% endif %}
-{{ input_text }}:{% endif %} +{% if widget.is_initial %}{{ widget.initial_text }}: {{ widget.value }}{% if not widget.required %} + +{% endif %}
+{{ widget.input_text }}:{% endif %} diff --git a/django/forms/widgets.py b/django/forms/widgets.py index 599d1e8011..01ada423c9 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -392,7 +392,7 @@ class ClearableFileInput(FileInput): context = super().get_context(name, value, attrs) checkbox_name = self.clear_checkbox_name(name) checkbox_id = self.clear_checkbox_id(checkbox_name) - context.update({ + context['widget'].update({ 'checkbox_name': checkbox_name, 'checkbox_id': checkbox_id, 'is_initial': self.is_initial(value), -- cgit v1.3