From 2a6fc89018881c07e38f81989ff0c012e7539390 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Tue, 28 Jan 2020 20:26:00 +0100 Subject: [PATCH] Refs #27852 -- Renamed a loop variable in Collector.collect() to avoid redefinition. --- django/db/models/deletion.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django/db/models/deletion.py b/django/db/models/deletion.py index 6ed12ec092..e7d245936c 100644 --- a/django/db/models/deletion.py +++ b/django/db/models/deletion.py @@ -324,8 +324,8 @@ class Collector: if fail_on_restricted: # Raise an error if collected restricted objects (RESTRICT) aren't # candidates for deletion also collected via CASCADE. - for model, instances in self.data.items(): - self.clear_restricted_objects_from_set(model, instances) + for related_model, instances in self.data.items(): + self.clear_restricted_objects_from_set(related_model, instances) for qs in self.fast_deletes: self.clear_restricted_objects_from_queryset(qs.model, qs) for model, fields in self.restricted_objects.items():