在删除信号上使用django-storages 包S3 我试图从 S3 中删除图像 我尝试了以下操作(见下文)但得到错误...
“ImageFieldFile”对象没有属性“startswith”
def product_pre_delete(sender, instance, **kwargs):
"""
Sent at the beginning of a product delete() method product queryset's delete() method.
"""
default_storage.delete(instance.qr_image)
models.signals.pre_delete.connect(product_pre_delete, sender=Product)