summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorRoman Selivanov <seroy@bk.ru>2017-07-19 18:24:27 +0300
committerTim Graham <timograham@gmail.com>2017-07-19 14:28:06 -0400
commitd4da39685b5974849c73e4c4dc6e07dfdf21c67a (patch)
tree0da3ca91d2f198e010b79af6150c1fbcc0485d85 /django/forms
parent3f7953846ee2e60a2cd56d6dea3b0ba9ffaa76c5 (diff)
Fixed #28414 -- Fixed ClearableFileInput rendering as a subwidget of MultiWidget.
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/jinja2/django/forms/widgets/clearable_file_input.html8
-rw-r--r--django/forms/templates/django/forms/widgets/clearable_file_input.html8
-rw-r--r--django/forms/widgets.py2
3 files changed, 9 insertions, 9 deletions
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 }}: <a href="{{ widget.value.url }}">{{ widget.value }}</a>{% if not widget.required %}
-<input type="checkbox" name="{{ checkbox_name }}" id="{{ checkbox_id }}" />
-<label for="{{ checkbox_id }}">{{ clear_checkbox_label }}</label>{% endif %}<br />
-{{ input_text }}:{% endif %}
+{% if widget.is_initial %}{{ widget.initial_text }}: <a href="{{ widget.value.url }}">{{ widget.value }}</a>{% if not widget.required %}
+<input type="checkbox" name="{{ widget.checkbox_name }}" id="{{ widget.checkbox_id }}" />
+<label for="{{ widget.checkbox_id }}">{{ widget.clear_checkbox_label }}</label>{% endif %}<br />
+{{ widget.input_text }}:{% endif %}
<input type="{{ widget.type }}" name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %} />
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 }}: <a href="{{ widget.value.url }}">{{ widget.value }}</a>{% if not widget.required %}
-<input type="checkbox" name="{{ checkbox_name }}" id="{{ checkbox_id }}" />
-<label for="{{ checkbox_id }}">{{ clear_checkbox_label }}</label>{% endif %}<br />
-{{ input_text }}:{% endif %}
+{% if widget.is_initial %}{{ widget.initial_text }}: <a href="{{ widget.value.url }}">{{ widget.value }}</a>{% if not widget.required %}
+<input type="checkbox" name="{{ widget.checkbox_name }}" id="{{ widget.checkbox_id }}" />
+<label for="{{ widget.checkbox_id }}">{{ widget.clear_checkbox_label }}</label>{% endif %}<br />
+{{ widget.input_text }}:{% endif %}
<input type="{{ widget.type }}" name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %} />
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),