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 1cd6e04cd4
given no regression tests fail when m2m_changed is not taken into
consideration to determine if fast-delete can be enabled.
This commit is contained in:
Simon Charette 2019-03-16 19:30:29 -04:00 committed by Mariusz Felisiak
parent 8180ffba21
commit 26c4be2ebe
1 changed files with 1 additions and 2 deletions

View File

@ -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.