By default the extra forms in a Django formset are rendered last:
{% for form in transactionForms %} <!-- render form here --> {% endfor %}
How do you make the extra forms come first in a Django formset; without substituting much of the guts of the BaseFormSet
class?
After viewing the code, inspiration (or perhaps the obvious) hits. In the template I just need to render formset.extra_forms
first; before rendering formset.initial_forms
:
{% for form in transactionForms.extra_forms %} <!-- render extra forms here --> {% endfor %} {% for form in transactionForms.initial_forms %} <!-- render initial forms here --> {% endfor %}