Ticket #6877: dj-label_suffix-fix.patch

File dj-label_suffix-fix.patch, 1.2 KB (added by Maxim Ivanov, 16 years ago)

quick fix fot label_tag and label_suffix problem

  • django/forms/forms.py

     
    150150                    output.append(error_row % force_unicode(bf_errors))
    151151                if bf.label:
    152152                    label = conditional_escape(force_unicode(bf.label))
    153                     # Only add the suffix if the label does not end in
    154                     # punctuation.
    155                     if self.label_suffix:
    156                         if label[-1] not in ':?.!':
    157                             label += self.label_suffix
    158153                    label = bf.label_tag(label) or ''
    159154                else:
    160155                    label = ''
     
    410405        If attrs are given, they're used as HTML attributes on the <label> tag.
    411406        """
    412407        contents = contents or conditional_escape(self.label)
     408        # Only add the suffix if the label does not end in
     409        # punctuation.
     410        if self.form.label_suffix:
     411            if contents[-1] not in ':?.!':
     412                contents += self.form.label_suffix
     413
    413414        widget = self.field.widget
    414415        id_ = widget.attrs.get('id') or self.auto_id
    415416        if id_:
Back to Top