Ticket #4511: forms-patch.py

File forms-patch.py, 2.0 KB (added by gustavo@…, 17 years ago)

The patch

Line 
1Index: forms.py
2===================================================================
3--- forms.py (revision 5427)
4+++ forms.py (working copy)
5@@ -136,7 +136,7 @@
6 help_text = help_text_html % field.help_text
7 else:
8 help_text = u''
9- output.append(normal_row % {'errors': bf_errors, 'label': label, 'field': unicode(bf), 'help_text': help_text})
10+ output.append(normal_row % {'name': name, 'errors': bf_errors, 'label': label, 'field': unicode(bf), 'help_text': help_text})
11 if top_errors:
12 output.insert(0, error_row % top_errors)
13 if hidden_fields: # Insert any hidden fields in the last row.
14@@ -151,15 +151,15 @@
15
16 def as_table(self):
17 "Returns this form rendered as HTML <tr>s -- excluding the <table></table>."
18- 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)
19+ return self._html_output(u'<tr id="%(name)s><th>%(label)s</th><td>%(errors)s%(field)s<span class="help_text">%(help_text)s</span></td></tr>', u'<tr><td colspan="2">%s</td></tr>', '</td></tr>', u'<br />%s', False)
20
21 def as_ul(self):
22 "Returns this form rendered as HTML <li>s -- excluding the <ul></ul>."
23- return self._html_output(u'<li>%(errors)s%(label)s %(field)s%(help_text)s</li>', u'<li>%s</li>', '</li>', u' %s', False)
24+ return self._html_output(u'<li id="%(name)s">%(errors)s%(label)s %(field)s<span class="help_text">%(help_text)s</span></li>', u'<li>%s</li>', '</li>', u' %s', False)
25
26 def as_p(self):
27 "Returns this form rendered as HTML <p>s."
28- return self._html_output(u'<p>%(label)s %(field)s%(help_text)s</p>', u'<p>%s</p>', '</p>', u' %s', True)
29+ return self._html_output(u'<p id="%(name)s>%(label)s %(field)s<span class="help_text">%(help_text)s</span></p>', u'<p>%s</p>', '</p>', u' %s', True)
30
31 def non_field_errors(self):
32 """
Back to Top