deleting all forms within a formset is not possible
|Reported by:||Patrick Kranzlmueller||Owned by:||nobody|
|Cc:||Vlastimil Zíma||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||yes|
|Needs tests:||no||Patch needs improvement:||no|
when using a formset with can_delete and trying to delete _all_ items within the formset, I´m getting this error:
'MyForm' object has no attribute 'cleaned_data'
the problem here seems to be that formset.is_valid() is True, but cleaned_data (which is used afterwards, of course) is not available.
this could be solved with using a custom BaseFormSet and overriding the clean-method. unfortunately, the clean-method is not called in the case where all items are deleted.
I´ve done a bit of research on this issue and I found this related topic:
although I think it´s a pretty good idea that deleted items don´t throw validation errors, I´m not sure if the above behaviour is intended.
Change History (33)
comment:13 Changed 7 years ago by
|Owner:||changed from Colin Copeland to nobody|
|Patch needs improvement:||unset|