diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2011-09-10 01:53:56 +0000 |
|---|---|---|
| committer | Alex Gaynor <alex.gaynor@gmail.com> | 2011-09-10 01:53:56 +0000 |
| commit | 01b0eb50fd4a3503a80524f5fd783b0dba038105 (patch) | |
| tree | ed16e2b03788c121eb429393d4d774c9ca17329f /docs | |
| parent | 5f287f75f2277ba821dcf5c444ab12d8eff6cce3 (diff) | |
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
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/forms/formsets.txt | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/topics/forms/formsets.txt b/docs/topics/forms/formsets.txt index a72fac947a..50679a1a31 100644 --- a/docs/topics/forms/formsets.txt +++ b/docs/topics/forms/formsets.txt @@ -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 --------------------------------- |
