diff options
| author | Baptiste Mispelon <bmispelon@gmail.com> | 2013-06-18 17:49:45 +0200 |
|---|---|---|
| committer | Baptiste Mispelon <bmispelon@gmail.com> | 2013-06-18 17:49:53 +0200 |
| commit | 3128f3d38d1db0bc01da9a4bf4be81119079d73a (patch) | |
| tree | 57e5f7056a17a807f25a5f7872bfdc72d3067533 /django | |
| parent | ee77d4b25360a9fc050c32769a334fd69a011a63 (diff) | |
Fixed #20618 -- Fixed regression in `BoundField.label_tag`.
Diffstat (limited to 'django')
| -rw-r--r-- | django/forms/forms.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/django/forms/forms.py b/django/forms/forms.py index e6a11f28fb..b25eeb30a4 100644 --- a/django/forms/forms.py +++ b/django/forms/forms.py @@ -518,9 +518,8 @@ class BoundField(object): """ contents = contents or self.label # Only add the suffix if the label does not end in punctuation. - if self.form.label_suffix: - if contents[-1] not in ':?.!': - contents = format_html('{0}{1}', contents, self.form.label_suffix) + if self.form.label_suffix and contents and contents[-1] not in ':?.!': + contents = format_html('{0}{1}', contents, self.form.label_suffix) widget = self.field.widget id_ = widget.attrs.get('id') or self.auto_id if id_: |
