diff options
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/boundfield.py | 2 | ||||
| -rw-r--r-- | django/forms/jinja2/django/forms/widgets/input_option.html | 2 | ||||
| -rw-r--r-- | django/forms/templates/django/forms/widgets/input_option.html | 2 | ||||
| -rw-r--r-- | django/forms/widgets.py | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py index d0ddd9715b..7f40fbbbb4 100644 --- a/django/forms/boundfield.py +++ b/django/forms/boundfield.py @@ -248,7 +248,7 @@ class BoundWidget: return self.tag(wrap_label=True) def tag(self, wrap_label=False): - context = {'widget': self.data, 'wrap_label': wrap_label} + context = {'widget': {**self.data, 'wrap_label': wrap_label}} return self.parent_widget._render(self.template_name, context, self.renderer) @property diff --git a/django/forms/jinja2/django/forms/widgets/input_option.html b/django/forms/jinja2/django/forms/widgets/input_option.html index 3f7085a4f0..48cd65b93a 100644 --- a/django/forms/jinja2/django/forms/widgets/input_option.html +++ b/django/forms/jinja2/django/forms/widgets/input_option.html @@ -1 +1 @@ -{% if wrap_label %}<label{% if widget.attrs.id %} for="{{ widget.attrs.id }}"{% endif %}>{% endif %}{% include "django/forms/widgets/input.html" %}{% if wrap_label %} {{ widget.label }}</label>{% endif %} +{% if widget.wrap_label %}<label{% if widget.attrs.id %} for="{{ widget.attrs.id }}"{% endif %}>{% endif %}{% include "django/forms/widgets/input.html" %}{% if widget.wrap_label %} {{ widget.label }}</label>{% endif %} diff --git a/django/forms/templates/django/forms/widgets/input_option.html b/django/forms/templates/django/forms/widgets/input_option.html index 3f7085a4f0..48cd65b93a 100644 --- a/django/forms/templates/django/forms/widgets/input_option.html +++ b/django/forms/templates/django/forms/widgets/input_option.html @@ -1 +1 @@ -{% if wrap_label %}<label{% if widget.attrs.id %} for="{{ widget.attrs.id }}"{% endif %}>{% endif %}{% include "django/forms/widgets/input.html" %}{% if wrap_label %} {{ widget.label }}</label>{% endif %} +{% if widget.wrap_label %}<label{% if widget.attrs.id %} for="{{ widget.attrs.id }}"{% endif %}>{% endif %}{% include "django/forms/widgets/input.html" %}{% if widget.wrap_label %} {{ widget.label }}</label>{% endif %} diff --git a/django/forms/widgets.py b/django/forms/widgets.py index 50e41b59ec..566bdf25d6 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -621,12 +621,12 @@ class ChoiceWidget(Widget): 'attrs': option_attrs, 'type': self.input_type, 'template_name': self.option_template_name, + 'wrap_label': True, } def get_context(self, name, value, attrs): context = super().get_context(name, value, attrs) context['widget']['optgroups'] = self.optgroups(name, context['widget']['value'], attrs) - context['wrap_label'] = True return context def id_for_label(self, id_, index='0'): |
