From 26c4be2ebe918601c0a13d4abb3f3cab49107c73 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Sat, 16 Mar 2019 19:30:29 -0400 Subject: [PATCH] Refs #18676 -- Enabled fast-delete for m2m_changed senders. There's no reason to disable fast-delete when an intermediary many-to-many model has connected m2m_changed receivers because the signal is only sent when related manager's clear() and remove() methods are directly called. This must have been overlooked in 1cd6e04cd4f768bcd4385b75de433d497d938f82 given no regression tests fail when m2m_changed is not taken into consideration to determine if fast-delete can be enabled. --- django/db/models/deletion.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/django/db/models/deletion.py b/django/db/models/deletion.py index 3a462f1c4c..d886331fcf 100644 --- a/django/db/models/deletion.py +++ b/django/db/models/deletion.py @@ -136,8 +136,7 @@ class Collector: else: return False if (signals.pre_delete.has_listeners(model) or - signals.post_delete.has_listeners(model) or - signals.m2m_changed.has_listeners(model)): + signals.post_delete.has_listeners(model)): return False # The use of from_field comes from the need to avoid cascade back to # parent when parent delete is cascading to child.