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
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
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."""
diff --git a/tests/regressiontests/forms/formsets.py b/tests/regressiontests/forms/formsets.py
index fade987c26..f8b8ae2a8a 100644
--- a/tests/regressiontests/forms/formsets.py
+++ b/tests/regressiontests/forms/formsets.py
@@ -1,4 +1,8 @@
# -*- coding: utf-8 -*-
+from django.test.testcases import TestCase
+from django.forms.forms import Form
+from django.forms.fields import CharField, IntegerField
+from django.forms.formsets import formset_factory
tests = """
# Basic FormSet creation and usage ############################################
@@ -722,3 +726,37 @@ False
You may only specify a drink once.
"""
+
+data = {
+ 'choices-TOTAL_FORMS': '1', # the number of forms rendered
+ 'choices-INITIAL_FORMS': '0', # the number of forms with initial data
+ 'choices-MAX_NUM_FORMS': '0', # max number of forms
+ 'choices-0-choice': 'Calexico',
+ 'choices-0-votes': '100',
+}
+
+class Choice(Form):
+ choice = CharField()
+ votes = IntegerField()
+
+ChoiceFormSet = formset_factory(Choice)
+
+class FormsetAsFooTests(TestCase):
+ def test_as_table(self):
+ formset = ChoiceFormSet(data, auto_id=False, prefix='choices')
+ self.assertEqual(formset.as_table(),"""
+