un1t / django-cleanup

Automatically deletes old file for FileField and ImageField. It also deletes files on models instance deletion.
MIT License
1.11k stars 79 forks source link

how it works with aws S3 #42

Closed Duonghailee closed 6 years ago

Duonghailee commented 6 years ago

Hi, I am having trouble to understand the thumbnail example. My case is that I have a class CV which has a file attribute - type : FileField.this file is stored in S3

Now I would like to send signal pre_delete to the model before its instance is going to be deleted. My issue is that I don't know how to import the CV model into the function. What i have tried. from django_cleanup.signals import cleanup_pre_delete, cleanup_post_delete

def CV(models.Model): ... file = models.FileFiles(path)

def cv_file_delete(**kwargs): from CV import delete // this is raising error delete(CV.file) cleanup_pre_delete.connect(cv_file_delete)

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.