diff --git a/django/forms/models.py b/django/forms/models.py
a
|
b
|
|
17 | 17 | from fields import Field, ChoiceField |
18 | 18 | from widgets import SelectMultiple, HiddenInput, MultipleHiddenInput |
19 | 19 | from widgets import media_property |
20 | | from formsets import BaseFormSet, formset_factory, DELETION_FIELD_NAME |
| 20 | from formsets import BaseFormSet, formset_factory |
21 | 21 | |
22 | 22 | __all__ = ( |
23 | 23 | 'ModelForm', 'BaseModelForm', 'model_to_dict', 'fields_for_model', |
… |
… |
|
612 | 612 | pk_value = getattr(pk_value, 'pk', pk_value) |
613 | 613 | |
614 | 614 | obj = self._existing_object(pk_value) |
615 | | if self.can_delete: |
616 | | raw_delete_value = form._raw_value(DELETION_FIELD_NAME) |
617 | | should_delete = form.fields[DELETION_FIELD_NAME].clean(raw_delete_value) |
618 | | if should_delete: |
619 | | self.deleted_objects.append(obj) |
620 | | obj.delete() |
621 | | continue |
| 615 | if self.can_delete and self._should_delete_form(form): |
| 616 | self.deleted_objects.append(obj) |
| 617 | obj.delete() |
| 618 | continue |
622 | 619 | if form.has_changed(): |
623 | 620 | self.changed_objects.append((obj, form.changed_data)) |
624 | 621 | saved_instances.append(self.save_existing(form, obj, commit=commit)) |
… |
… |
|
633 | 630 | continue |
634 | 631 | # If someone has marked an add form for deletion, don't save the |
635 | 632 | # object. |
636 | | if self.can_delete: |
637 | | raw_delete_value = form._raw_value(DELETION_FIELD_NAME) |
638 | | should_delete = form.fields[DELETION_FIELD_NAME].clean(raw_delete_value) |
639 | | if should_delete: |
640 | | continue |
| 633 | if self.can_delete and self._should_delete_form(form): |
| 634 | continue |
641 | 635 | self.new_objects.append(self.save_new(form, commit=commit)) |
642 | 636 | if not commit: |
643 | 637 | self.saved_forms.append(form) |