deals_formset_factory = modelformset_factory(Deal, form=DealCForm, extra=1, can_delete=True, max_num=5)
deals_formset = deals_formset_factory(queryset=query)
Is there a way to say the one extra form shall always be the first
form no matter how many more instance forms are within the deals_formset?
I found this bit in the documentation:
Iterating over the formset will render the forms in the order they were created. You can change this order by providing an alternate implementation for the
__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.
As I am still a bit new to python/django, I don't know where to begin.
Is there any short example how __iter__() and __getitem() override have to look like?
many Thanks