mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Make `Formset.__getitem__ O(1), rather than O(n). If you override __iter__ you now need to also override __getitem__` for consistant behavior. Thanks to Carl and Russ for the review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16770 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -49,6 +49,10 @@ they were created. The default formset iterator also renders the forms
|
||||
in this order, but you can change this order by providing an alternate
|
||||
implementation for the :meth:`__iter__()` method.
|
||||
|
||||
Formsets can also be indexed into, which returns the corresponding form. If you
|
||||
override ``__iter__``, you will need to also override ``__getitem__`` to have
|
||||
matching behavior.
|
||||
|
||||
Using initial data with a formset
|
||||
---------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user