#15224 closed (wontfix)
FileField object doesn't deletes the associated files
Reported by: | Owned by: | Rohan Jain | |
---|---|---|---|
Component: | File uploads/storage | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When an object of Model with FileField is deleted, the files associated with it persist in the filesystem. An issue due to this on my project: https://github.com/dcrodjer/codesport/issues/#issue/1
Change History (4)
comment:1 by , 14 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
follow-up: 3 comment:2 by , 14 years ago
Just saw this older ticket: http://code.djangoproject.com/ticket/6456, it says that this was done intentionally.
So how can someone deal with tests which involve file fields. One can't let the tests create so many files in the directory on each test run.
comment:3 by , 14 years ago
Replying to Rohan Jain <m@…>:
Just saw this older ticket: http://code.djangoproject.com/ticket/6456, it says that this was done intentionally.
So how can someone deal with tests which involve file fields. One can't let the tests create so many files in the directory on each test run.
You can create a temporary directory during setUp of your test case and make sure your storage backend uses it to save files, then delete the directory in tearDown. If you need more details, feel free to ask on django-users.
This has been recently changed, to explicitly not delete the files: http://code.djangoproject.com/ticket/6456; So I'm marking it as "won't fix".