diff -r 8c064fcf7778 django/forms/formsets.py
a
|
b
|
|
328 | 328 | forms = u' '.join([form.as_table() for form in self.forms]) |
329 | 329 | return mark_safe(u'\n'.join([unicode(self.management_form), forms])) |
330 | 330 | |
| 331 | def as_p(self): |
| 332 | "Returns this formset rendered as HTML <p>s." |
| 333 | forms = u' '.join([form.as_p() for form in self.forms]) |
| 334 | return mark_safe(u'\n'.join([unicode(self.management_form), forms])) |
| 335 | |
| 336 | def as_ul(self): |
| 337 | "Returns this formset rendered as HTML <li>s." |
| 338 | forms = u' '.join([form.as_ul() for form in self.forms]) |
| 339 | return mark_safe(u'\n'.join([unicode(self.management_form), forms])) |
| 340 | |
331 | 341 | def formset_factory(form, formset=BaseFormSet, extra=1, can_order=False, |
332 | 342 | can_delete=False, max_num=None): |
333 | 343 | """Return a FormSet for the given form class.""" |
diff -r 8c064fcf7778 tests/regressiontests/forms/formsets.py
a
|
b
|
|
688 | 688 | <tr><th><label for="id_form-0-name">Name:</label></th><td><input type="text" name="form-0-name" value="Gin Tonic" id="id_form-0-name" /></td></tr> |
689 | 689 | <tr><th><label for="id_form-1-name">Name:</label></th><td><input type="text" name="form-1-name" id="id_form-1-name" /></td></tr> |
690 | 690 | |
| 691 | >>> print formset.as_table() |
| 692 | <input type="hidden" name="form-TOTAL_FORMS" value="2" id="id_form-TOTAL_FORMS" /><input type="hidden" name="form-INITIAL_FORMS" value="1" id="id_form-INITIAL_FORMS" /><input type="hidden" name="form-MAX_NUM_FORMS" value="2" id="id_form-MAX_NUM_FORMS" /> |
| 693 | <tr><th><label for="id_form-0-name">Name:</label></th><td><input type="text" name="form-0-name" value="Gin Tonic" id="id_form-0-name" /></td></tr> <tr><th><label for="id_form-1-name">Name:</label></th><td><input type="text" name="form-1-name" id="id_form-1-name" /></td></tr> |
| 694 | |
| 695 | >>> print formset.as_p() |
| 696 | <input type="hidden" name="form-TOTAL_FORMS" value="2" id="id_form-TOTAL_FORMS" /><input type="hidden" name="form-INITIAL_FORMS" value="1" id="id_form-INITIAL_FORMS" /><input type="hidden" name="form-MAX_NUM_FORMS" value="2" id="id_form-MAX_NUM_FORMS" /> |
| 697 | <p><label for="id_form-0-name">Name:</label> <input type="text" name="form-0-name" value="Gin Tonic" id="id_form-0-name" /></p> <p><label for="id_form-1-name">Name:</label> <input type="text" name="form-1-name" id="id_form-1-name" /></p> |
| 698 | |
| 699 | >>> print formset.as_ul() |
| 700 | <input type="hidden" name="form-TOTAL_FORMS" value="2" id="id_form-TOTAL_FORMS" /><input type="hidden" name="form-INITIAL_FORMS" value="1" id="id_form-INITIAL_FORMS" /><input type="hidden" name="form-MAX_NUM_FORMS" value="2" id="id_form-MAX_NUM_FORMS" /> |
| 701 | <li><label for="id_form-0-name">Name:</label> <input type="text" name="form-0-name" value="Gin Tonic" id="id_form-0-name" /></li> <li><label for="id_form-1-name">Name:</label> <input type="text" name="form-1-name" id="id_form-1-name" /></li> |
691 | 702 | |
692 | 703 | # Regression test for #6926 ################################################## |
693 | 704 | |