Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#15224 closed (wontfix)

FileField object doesn't deletes the associated files

Reported by: Rohan Jain <m@…> Owned by: crodjer
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

Attachments (0)

Change History (4)

comment:1 Changed 3 years ago by lrekucki

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

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

Last edited 3 years ago by lrekucki (previous) (diff)

comment:2 follow-up: Changed 3 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 3 years ago by lrekucki

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 3 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.