diff --git a/django/forms/formsets.py b/django/forms/formsets.py
index 1ec8340..d652130 100644
a
|
b
|
class BaseFormSet(StrAndUnicode):
|
251 | 251 | errors = property(_get_errors) |
252 | 252 | |
253 | 253 | def _should_delete_form(self, form): |
254 | | # The way we lookup the value of the deletion field here takes |
255 | | # more code than we'd like, but the form's cleaned_data will |
256 | | # not exist if the form is invalid. |
257 | | field = form.fields[DELETION_FIELD_NAME] |
258 | | raw_value = form._raw_value(DELETION_FIELD_NAME) |
259 | | should_delete = field.clean(raw_value) |
260 | | return should_delete |
| 254 | return form.cleaned_data.get(DELETION_FIELD_NAME, False) |
261 | 255 | |
262 | 256 | def is_valid(self): |
263 | 257 | """ |
diff --git a/django/forms/models.py b/django/forms/models.py
index e6ae357..553f174 100644
a
|
b
|
class BaseModelFormSet(BaseFormSet):
|
596 | 596 | return [] |
597 | 597 | |
598 | 598 | saved_instances = [] |
| 599 | try: |
| 600 | forms_to_delete = self.deleted_forms |
| 601 | except AttributeError: |
| 602 | forms_to_delete = [] |
599 | 603 | for form in self.initial_forms: |
600 | 604 | pk_name = self._pk_field.name |
601 | 605 | raw_pk_value = form._raw_value(pk_name) |
… |
… |
class BaseModelFormSet(BaseFormSet):
|
606 | 610 | pk_value = getattr(pk_value, 'pk', pk_value) |
607 | 611 | |
608 | 612 | obj = self._existing_object(pk_value) |
609 | | if self.can_delete and self._should_delete_form(form): |
| 613 | if form in forms_to_delete: |
610 | 614 | self.deleted_objects.append(obj) |
611 | 615 | obj.delete() |
612 | 616 | continue |