formsets should be iterable
|Reported by:||kenth||Owned by:||pandres|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I have a inlineformset where I need to be able to display some of the "extra" forms (that I initialize) before some of the "initial" forms retrieved from the db. This would be easy if I could just override formset's iter method and get the forms to come out in an order different from the creation order. This patch adds this hook.
This patch also makes it possible to say "for form in formset" (instead of "for form in formset.forms") in both code & templates. There are no backward compatibility issues.
The pattern "for form in formset" is also closer to the "for field in form" idiom.
Change History (17)
comment:4 Changed 6 years ago by
|Status:||closed → reopened|
|Triage Stage:||Unreviewed → Accepted|