models.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:Shelter 作者: ShelterAssociates 项目源码 文件源码
def update_zipfile(sender, instance, **kwargs):
    """ Delete zip file on pre_save. This is needed in case of updation of 
        zip file, where the older file should be deleted from the location"""
    if instance.pk:
        details = SponsorProjectDetailsSubFields.objects.get(pk=instance.pk)
        if details.zip_file and details.zip_file.url != instance.zip_file.url:
            storage, path = details.zip_file.storage, details.zip_file.path
            storage.delete(path)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号