#14655: formsets should be iterable
-------------------------------+--------------------------------------------
          Reporter:  kenth     |         Owner:  pandres
            Status:  reopened  |     Milestone:         
         Component:  Forms     |       Version:  SVN    
        Resolution:            |      Keywords:         
             Stage:  Accepted  |     Has_patch:  1      
        Needs_docs:  0         |   Needs_tests:  0      
Needs_better_patch:  0         |  
-------------------------------+--------------------------------------------
Comment (by kenth):

 @ikelly, thanks for your help. Duh on returning iter(self.forms). I too
 don't like  the `__getitem__` and `__len__` methods, but they're required
 to pass the unit tests (mainly in modelforms). And since they're required,
 I implemented ones that worked correctly -- if slowly -- instead of
 requiring all three methods be overridden if `__iter__` is. My formset
 which required reordering rendered forms (e.g. a sparse many-to-many
 relationship table of per-user ratings of beatles albums that I want to be
 rendered in album order, mixing "existing" and "extra" forms) would only
 require the `__iter__` method. An inefficient but correct method for the
 (probably never used except in unit test) ancillary methods seemed like
 the way to go.

 Of course, you improved my base `__iter__` method. Any suggestions on the
 others would be great. I'd like to get the `__iter__` hook into django.
 Python is not (yet) my best language.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/14655#comment:8>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to