3
在我的應用程序post_delete
信號被記錄在一個特定的模型和它被刪除。Django級聯刪除和post_delete信號
class A(models.Model):
...
class B(models.Model):
a = models.ForeignKey('A')
class C(models.Model):
b = models.ForeignKey('B')
def log_delete(sender, instance, **kwargs):
logging
post_delete.connect(log_delete, sender = A)
post_delete.connect(log_delete, sender = C)
當您刪除級聯刪除實例時,會刪除B和C實例。如何禁用django級聯刪除子實例的信號?