Ticket #12074: django-formset-as_p-as_ul.diff

File django-formset-as_p-as_ul.diff, 988 bytes (added by Arthur Debert, 15 years ago)
  • django/forms/formsets.py

     
    301301        forms = u' '.join([form.as_table() for form in self.forms])
    302302        return mark_safe(u'\n'.join([unicode(self.management_form), forms]))
    303303
     304    def as_p(self):
     305        "Returns this formset rendered as HTML <p>s."
     306        forms = u' '.join([form.as_table() for form in self.forms])
     307        return mark_safe(u'\n'.join([unicode(self.management_form), forms]))
     308
     309    def as_ul(self):
     310        "Returns this formset rendered as HTML <li>s."
     311        forms = u' '.join([form.as_ul() for form in self.forms])
     312        return mark_safe(u'\n'.join([unicode(self.management_form), forms]))
     313
    304314def formset_factory(form, formset=BaseFormSet, extra=1, can_order=False,
    305315                    can_delete=False, max_num=0):
    306316    """Return a FormSet for the given form class."""
Back to Top