Ticket #9854: django-form-patch.diff
File django-form-patch.diff, 1.9 KB (added by , 16 years ago) |
---|
-
forms.py
17 17 18 18 NON_FIELD_ERRORS = '__all__' 19 19 20 try: 21 from django.conf import settings 22 FORM_HELP_TEXT_HTML = settings.FORM_HELP_TEXT_HTML 23 except ImportError: 24 FORM_HELP_TEXT_HTML = u' %s' 25 20 26 def pretty_name(name): 21 27 "Converts 'first_name' to 'First name'" 22 28 name = name[0].upper() + name[1:] … … 63 69 new_class.media = media_property(new_class) 64 70 return new_class 65 71 72 66 73 class BaseForm(StrAndUnicode): 67 74 # This is the main implementation of all the Form logic. Note that this 68 75 # class is different than Form. See the comments by the Form class for more … … 187 194 188 195 def as_table(self): 189 196 "Returns this form rendered as HTML <tr>s -- excluding the <table></table>." 190 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)197 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>', FORM_HELP_TEXT_HTML, False) 191 198 192 199 def as_ul(self): 193 200 "Returns this form rendered as HTML <li>s -- excluding the <ul></ul>." 194 return self._html_output(u'<li>%(errors)s%(label)s %(field)s%(help_text)s</li>', u'<li>%s</li>', '</li>', u' %s', False)201 return self._html_output(u'<li>%(errors)s%(label)s %(field)s%(help_text)s</li>', u'<li>%s</li>', '</li>', FORM_HELP_TEXT_HTML, False) 195 202 196 203 def as_p(self): 197 204 "Returns this form rendered as HTML <p>s." 198 return self._html_output(u'<p>%(label)s %(field)s%(help_text)s</p>', u'%s', '</p>', u' %s', True)205 return self._html_output(u'<p>%(label)s %(field)s%(help_text)s</p>', u'%s', '</p>', FORM_HELP_TEXT_HTML, True) 199 206 200 207 def non_field_errors(self): 201 208 """