diff --git a/django/forms/formsets.py b/django/forms/formsets.py
index 6d92236..6a814d4 100644
a
|
b
|
class BaseFormSet(StrAndUnicode):
|
48 | 48 | |
49 | 49 | def __unicode__(self): |
50 | 50 | return self.as_table() |
| 51 | |
| 52 | def __iter__(self): |
| 53 | """Yields the forms in the order they should be rendered""" |
| 54 | return iter(self.forms) |
| 55 | def __getitem__(self, index): |
| 56 | return list(self)[index] |
| 57 | def __len__(self): |
| 58 | return len(list(self)) |
51 | 59 | |
52 | 60 | def _management_form(self): |
53 | 61 | """Returns the ManagementForm instance for this FormSet.""" |
… |
… |
class BaseFormSet(StrAndUnicode):
|
323 | 331 | # XXX: there is no semantic division between forms here, there |
324 | 332 | # probably should be. It might make sense to render each form as a |
325 | 333 | # table row with each field as a td. |
326 | | forms = u' '.join([form.as_table() for form in self.forms]) |
| 334 | forms = u' '.join([form.as_table() for form in self]) |
327 | 335 | return mark_safe(u'\n'.join([unicode(self.management_form), forms])) |
328 | 336 | |
329 | 337 | def as_p(self): |
330 | 338 | "Returns this formset rendered as HTML <p>s." |
331 | | forms = u' '.join([form.as_p() for form in self.forms]) |
| 339 | forms = u' '.join([form.as_p() for form in self]) |
332 | 340 | return mark_safe(u'\n'.join([unicode(self.management_form), forms])) |
333 | 341 | |
334 | 342 | def as_ul(self): |
335 | 343 | "Returns this formset rendered as HTML <li>s." |
336 | | forms = u' '.join([form.as_ul() for form in self.forms]) |
| 344 | forms = u' '.join([form.as_ul() for form in self]) |
337 | 345 | return mark_safe(u'\n'.join([unicode(self.management_form), forms])) |
338 | 346 | |
339 | 347 | def formset_factory(form, formset=BaseFormSet, extra=1, can_order=False, |