Closed singhravi1 closed 5 years ago
If I understand what you suggesting, this app would have to load all data in the database and search all of it before deleting any file. Please correct me if I am misunderstanding. But if what I understood is the case then I think this would be firmly a "wontfix".
Multiple instances referencing the same file is not a case that is supported and I would recommend you consider using a file manager app that centralizes references to a file such as django-filer or django-filebrowser or roll your own that supports your use case.
Okay. I understand.
Can you suggest, how can i delete an instance without deleting its associated file?
Will this issue be solved when the “don’t delete default file” feature is merged to master? Or is this a different issue from that?
I dont think so.
Besides, the issue would actually be a 'wontfix' if we have to search every FileField in database before deleting a file.
This case is, i think, not common, that same image would be referenced in multiple models. For this, i have added a setting field which specifies a list of model names for which file should not be deleted. This was the patch for my situation.
resolved with #47
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.
If a file is saved in multiple instances, then removing a single instance removes the file and cause 'file not found' error for every other instance.
We need to check if the file is referenced in any other object before deleting.