When I use a formset that's both can_order
and can_delete
I'm able to get all the deleted forms with .deleted_forms
and all the non-deleted forms (in order) with .ordered_forms
.
If I use a formset that doesn't use can_order
I no longer have access to .ordered_forms
(it throws an exception). Is there an easy way to get the list of forms that are not deleted?
The closest I can find is manually creating it with:
[form for form in formset.forms if not formset._should_delete_form(form)]
However, that's using a "hidden" method and it seems odd there's not something already built-in.
can_order
orcan_delete
. This works, but only if you always knowcan_delete=True
. I guess you could testcan_delete
and if it were false then useformset.forms
and if true then use what you've suggested. – Magbie