1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #20618 -- Fixed regression in BoundField.label_tag.

This commit is contained in:
Baptiste Mispelon
2013-06-18 17:49:45 +02:00
parent ee77d4b253
commit 3128f3d38d
2 changed files with 9 additions and 3 deletions

View File

@@ -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_: