diff --git a/django/forms/models.py b/django/forms/models.py
index 26f8691..459c5dd 100644
a
|
b
|
class BaseModelFormSet(BaseFormSet):
|
596 | 596 | |
597 | 597 | saved_instances = [] |
598 | 598 | for form in self.initial_forms: |
599 | | pk_name = self._pk_field.name |
600 | | raw_pk_value = form._raw_value(pk_name) |
601 | | |
602 | | # clean() for different types of PK fields can sometimes return |
603 | | # the model instance, and sometimes the PK. Handle either. |
604 | | pk_value = form.fields[pk_name].clean(raw_pk_value) |
605 | | pk_value = getattr(pk_value, 'pk', pk_value) |
606 | | |
607 | | obj = self._existing_object(pk_value) |
| 599 | obj = form.instance |
608 | 600 | if self.can_delete and self._should_delete_form(form): |
609 | 601 | self.deleted_objects.append(obj) |
610 | | obj.delete() |
| 602 | if obj.pk != None: |
| 603 | obj.delete() |
611 | 604 | continue |
612 | 605 | if form.has_changed(): |
613 | 606 | self.changed_objects.append((obj, form.changed_data)) |