diff options
| author | Baptiste Mispelon <bmispelon@gmail.com> | 2013-04-06 16:04:30 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-04-12 10:17:17 +0200 |
| commit | ab686022f8619b57e7f851fb2ce8617583d70d8d (patch) | |
| tree | 97202e9ca850b39fc279e99a02a0be00e6962da6 /django/forms/forms.py | |
| parent | 0f99246b6f4e7d08600c19fbbeb8feb1a335f985 (diff) | |
Fixed #20211: Document backwards-incompatible change in BoundField.label_tag
Also cleaned up label escaping and consolidated the test suite regarding
label_tag.
Diffstat (limited to 'django/forms/forms.py')
| -rw-r--r-- | django/forms/forms.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/forms/forms.py b/django/forms/forms.py index 5bc9b2d500..f3a0fe6b38 100644 --- a/django/forms/forms.py +++ b/django/forms/forms.py @@ -519,7 +519,7 @@ class BoundField(object): If attrs are given, they're used as HTML attributes on the <label> tag. """ - contents = contents or conditional_escape(self.label) + contents = contents or self.label widget = self.field.widget id_ = widget.attrs.get('id') or self.auto_id if id_: @@ -527,6 +527,8 @@ class BoundField(object): contents = format_html('<label for="{0}"{1}>{2}</label>', widget.id_for_label(id_), attrs, contents ) + else: + contents = conditional_escape(contents) return mark_safe(contents) def css_classes(self, extra_classes=None): |
