1
0
mirror of https://github.com/django/django.git synced 2025-07-04 17:59:13 +00:00

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
This commit is contained in:
Russell Keith-Magee 2007-11-06 02:38:12 +00:00
parent 94954862d5
commit 99e8171a61

View File

@ -269,7 +269,7 @@ class BaseModelFormSet(BaseFormSet):
# update/save existing instances # update/save existing instances
for form in self.change_forms: for form in self.change_forms:
instance = instances[form.cleaned_data[self.model._meta.pk.attname]] 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() instance.delete()
else: else:
saved_instances.append(self.save_instance(form, instance, commit=commit)) saved_instances.append(self.save_instance(form, instance, commit=commit))