Fixed #9061 -- Allowed FormSets to disable deleting extra forms.

Thanks to Dan Ward for the initial patch.
This commit is contained in:
David Smith 2020-06-19 22:46:25 +01:00 committed by Mariusz Felisiak
parent 2e8941b6f9
commit 162765d6c3
8 changed files with 135 additions and 14 deletions

View file

@ -593,6 +593,18 @@ On the other hand, if you are using a plain ``FormSet``, it's up to you to
handle ``formset.deleted_forms``, perhaps in your formset's ``save()`` method,
as there's no general notion of what it means to delete a form.
``can_delete_extra``
--------------------
.. versionadded:: 3.2
.. attribute:: BaseFormSet.can_delete_extra
Default: ``True``
While setting ``can_delete=True``, specifying ``can_delete_extra=False`` will
remove the option to delete extra forms.
Adding additional fields to a formset
=====================================