root/misc/forms.py.patch
| Revision 58, 2.1 kB (checked in by razor, 22 months ago) |
|---|
-
forms.py
162 162 help_text = help_text_html % force_unicode(field.help_text) 163 163 else: 164 164 help_text = u'' 165 output.append(normal_row % {' errors': force_unicode(bf_errors), 'label': force_unicode(label), 'field': unicode(bf), 'help_text': help_text})165 output.append(normal_row % {'classes': "%s %s %s" % (type(field).__name__, type(field.widget).__name__, field.required and "Required" or "Optional"), 'errors': force_unicode(bf_errors), 'label': force_unicode(label), 'field': unicode(bf), 'help_text': help_text}) 166 166 if top_errors: 167 167 output.insert(0, error_row % force_unicode(top_errors)) 168 168 if hidden_fields: # Insert any hidden fields in the last row. … … 180 180 181 181 def as_table(self): 182 182 "Returns this form rendered as HTML <tr>s -- excluding the <table></table>." 183 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)183 return self._html_output(u'<tr class="%(classes)s"><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) 184 184 185 185 def as_ul(self): 186 186 "Returns this form rendered as HTML <li>s -- excluding the <ul></ul>." 187 return self._html_output(u'<li >%(errors)s%(label)s %(field)s%(help_text)s</li>', u'<li>%s</li>', '</li>', u' %s', False)187 return self._html_output(u'<li class="%(classes)s">%(errors)s%(label)s %(field)s%(help_text)s</li>', u'<li>%s</li>', '</li>', u' %s', False) 188 188 189 189 def as_p(self): 190 190 "Returns this form rendered as HTML <p>s." 191 return self._html_output(u'<p >%(label)s %(field)s%(help_text)s</p>', u'%s', '</p>', u' %s', True)191 return self._html_output(u'<p class="%(classes)s">%(label)s %(field)s%(help_text)s</p>', u'%s', '</p>', u' %s', True) 192 192 193 193 def non_field_errors(self): 194 194 """
Note: See TracBrowser
for help on using the browser.
