From 99e8171a610389e295a83b6f69b4e4d442984a2f Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 6 Nov 2007 02:38:12 +0000 Subject: [PATCH] newforms-admin: Fixed #5758 -- Added a check to ensure that an inline model formset is actually deletable before checking the deletion field. Thanks, Brian Rosner and akaihola. git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@6654 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/newforms/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/newforms/models.py b/django/newforms/models.py index 5fdbc4d959..31ed13c2b6 100644 --- a/django/newforms/models.py +++ b/django/newforms/models.py @@ -269,7 +269,7 @@ class BaseModelFormSet(BaseFormSet): # update/save existing instances for form in self.change_forms: instance = instances[form.cleaned_data[self.model._meta.pk.attname]] - if form.cleaned_data[DELETION_FIELD_NAME]: + if self.deletable and form.cleaned_data[DELETION_FIELD_NAME]: instance.delete() else: saved_instances.append(self.save_instance(form, instance, commit=commit))