From 0f31d10c7cf94318395f51d2613297acf1970e69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pasternak?= Date: Sat, 24 Sep 2022 12:16:20 +0200 Subject: [PATCH] Fixed #34023 -- Added inline argument to user_deleted_form(). This binds the loop variable. --- django/contrib/admin/options.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 9519faaa0d..5f07a4208a 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -2259,7 +2259,7 @@ class ModelAdmin(BaseModelAdmin): formset_params = self.get_formset_kwargs(request, obj, inline, prefix) formset = FormSet(**formset_params) - def user_deleted_form(request, obj, formset, index): + def user_deleted_form(request, obj, formset, index, inline): """Return whether or not the user deleted the form.""" return ( inline.has_delete_permission(request, obj) @@ -2270,7 +2270,7 @@ class ModelAdmin(BaseModelAdmin): # data won't be in request.POST), unless the form was deleted. if not inline.has_change_permission(request, obj if change else None): for index, form in enumerate(formset.initial_forms): - if user_deleted_form(request, obj, formset, index): + if user_deleted_form(request, obj, formset, index, inline): continue form._errors = {} form.cleaned_data = form.initial