Ticket #6043: newforms_forms.py.diff

File newforms_forms.py.diff, 1.5 KB (added by yong27@…, 17 years ago)
  • django/newforms/forms.py

     
    131131                    help_text = help_text_html % force_unicode(field.help_text)
    132132                else:
    133133                    help_text = u''
    134                 output.append(normal_row % {'errors': force_unicode(bf_errors), 'label': force_unicode(label), 'field': unicode(bf), 'help_text': help_text})
     134                output.append(normal_row % {'errors': force_unicode(bf_errors), 'label': force_unicode(label), 'field': unicode(bf), 'help_text': help_text, 'required': field.required and '<span class="required"> * </span>' or ''})
    135135        if top_errors:
    136136            output.insert(0, error_row % top_errors)
    137137        if hidden_fields: # Insert any hidden fields in the last row.
     
    149149
    150150    def as_table(self):
    151151        "Returns this form rendered as HTML <tr>s -- excluding the <table></table>."
    152         return self._html_output(u'<tr><th>%(label)s</th><td>%(errors)s%(field)s%(help_text)s</td></tr>', u'<tr><td colspan="2">%s</td></tr>', '</td></tr>', u'<br />%s', False)
     152        return self._html_output(u'<tr><th>%(label)s</th><td>%(errors)s%(field)s%(help_text)s%(required)s</td></tr>', u'<tr><td colspan="2">%s</td></tr>', '</td></tr>', u'<br />%s', False)
    153153
    154154    def as_ul(self):
    155155        "Returns this form rendered as HTML <li>s -- excluding the <ul></ul>."
Back to Top