14042 fix cache count for mptt child delete

This commit is contained in:
Arthur 2023-10-16 10:41:28 -07:00
parent 14447befb9
commit 8fc41f9aaf

View File

@ -72,6 +72,9 @@ def post_delete_receiver(sender, instance, **kwargs):
# Decrement the parent's counter by one
if parent_pk is not None:
# MPTT sends two delete signals if child element so guard against multiple decrements
origin = kwargs.get('origin')
if not origin or origin == instance:
update_counter(parent_model, parent_pk, counter_name, -1)