Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#15224 closed (wontfix)

FileField object doesn't deletes the associated files

Reported by: Rohan Jain <m@…> Owned by: Rohan Jain
Component: File uploads/storage Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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 Changed 6 years ago by Łukasz Rekucki

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: wontfix
Status: newclosed

This has been recently changed, to explicitly not delete the files in ticket #6456. I'm marking it as "won't fix".

Last edited 6 years ago by Łukasz Rekucki (previous) (diff)

comment:2 Changed 6 years ago by 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.

comment:3 in reply to:  2 Changed 6 years ago by Łukasz Rekucki

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.

comment:4 Changed 5 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top