summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorHonza Král <honza.kral@gmail.com>2010-10-18 04:44:49 +0000
committerHonza Král <honza.kral@gmail.com>2010-10-18 04:44:49 +0000
commitc5df329996ca4801b0d97d4a70bc1bea6b8663c4 (patch)
tree9e84ebb28349f44013600774c6bead52ffa10800 /django
parent59952b6f9a35bc6fce19d3bc199c7e6c892e2c38 (diff)
Fixed #12074 -- Adding .as_p and as_ul methods to FormSet. Thanks arthurdebert and dpn for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14250 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/forms/formsets.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/django/forms/formsets.py b/django/forms/formsets.py
index 508950eee9..62a25bf737 100644
--- a/django/forms/formsets.py
+++ b/django/forms/formsets.py
@@ -326,6 +326,16 @@ class BaseFormSet(StrAndUnicode):
forms = u' '.join([form.as_table() for form in self.forms])
return mark_safe(u'\n'.join([unicode(self.management_form), forms]))
+ def as_p(self):
+ "Returns this formset rendered as HTML <p>s."
+ forms = u' '.join([form.as_p() for form in self.forms])
+ return mark_safe(u'\n'.join([unicode(self.management_form), forms]))
+
+ def as_ul(self):
+ "Returns this formset rendered as HTML <li>s."
+ forms = u' '.join([form.as_ul() for form in self.forms])
+ return mark_safe(u'\n'.join([unicode(self.management_form), forms]))
+
def formset_factory(form, formset=BaseFormSet, extra=1, can_order=False,
can_delete=False, max_num=None):
"""Return a FormSet for the given form class."""