Ticket #8993: forms_formsets.diff
File forms_formsets.diff, 1.7 KB (added by , 16 years ago) |
---|
-
django/forms/formsets.py
272 272 forms = u' '.join([form.as_table() for form in self.forms]) 273 273 return mark_safe(u'\n'.join([unicode(self.management_form), forms])) 274 274 275 def as_table_wide(self): 276 "Returns this formset rendered as HTML <tr>s -- excluding the <table></table>." 277 forms = u'\n'.join(['<tr>'+form.as_row()+'</tr>' 278 for form in self.forms]) 279 return mark_safe(u'\n'.join([unicode(self.management_form), forms])) 280 275 281 def formset_factory(form, formset=BaseFormSet, extra=1, can_order=False, 276 282 can_delete=False, max_num=0): 277 283 """Return a FormSet for the given form class.""" -
django/forms/forms.py
182 182 "Returns this form rendered as HTML <tr>s -- excluding the <table></table>." 183 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) 184 184 185 def as_row(self): 186 "Returns this form rendered as HTML <td>s -- excluding the <tr></tr>." 187 return self._html_output(u'<td>%(errors)s%(field)s</td>', u'<td colspan="0">%s</td></tr><tr>', '</td>', u'<br />%s', False) 188 185 189 def as_ul(self): 186 190 "Returns this form rendered as HTML <li>s -- excluding the <ul></ul>." 187 191 return self._html_output(u'<li>%(errors)s%(label)s %(field)s%(help_text)s</li>', u'<li>%s</li>', '</li>', u' %s', False)