1👍
Thanks to @Anentropic’s comment and this question django temporarily disable signals I was able to come up with this solution. I didn’t have to change any of the existing code from my question.
@receiver(signals.pre_delete, sender=Parent)
def handle_delete_project(sender, instance, **kwargs):
signals.post_delete.disconnect(handle_delete_child, sender=Child)
@receiver(signals.post_delete, sender=Parent)
def handle_delete_project(sender, instance, **kwargs):
signals.post_delete.connect(handle_delete_child, sender=Child)
Before that I tried doing this in the Parent.delete
method, but that doesn’t get called if you’re bulk deleting in the Django admin.
Source:stackexchange.com