更新时间:2023-01-30 19:59:56
删除实例不会删除关联的文件.您可以考虑使用signals
精确地表示pre_delete
.您可以编写一个接收器,在其中可以删除关联的文件.
Deleting an instance would not delete the associated file. You may consider using signals
to be precise pre_delete
. You can write a receiver where in you can delete the associated file.
from django.dispatch import receiver
from django.db.models.signals import pre_delete
@receiver(pre_delete)
def func_name(sender, instance, **kwargs):
your logic
您可以在此处找到文档..
You can find documentation here.