﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
11663	Delete orphaned replaced files	Chris Beaven	Chris Beaven	"When using a model instance with a `FileField` (or subclass), you can update the image by setting a new file as an instance matching the field. This leaves the potential of an orphaned file.

A common case is that you have a `ModelForm` (bound to an existing instance) for which you use to upload a new file:

  * The form is saved in your view which overwrites the linked `FieldFile` with a new one (which will be based on the data from the `UploadedFile`).
  * Now there is no reference to the old file, so even custom storage can't touch it (unless you use an `upload_to` callable which names it the same and your custom storage is changed to ''dangerously'' blindly overwrite files with the same name).

Note, the delete orphan logic already exists - `FileField` attaches a post_delete signal to it's Model class which does this.

This is obviously a change in functionality. To preserve backwards compatibility, I recommend that this is a new argument on `FileField` (off by default)."	Uncategorized	closed	File uploads/storage	dev	Normal	wontfix		Johannes Bornhold	Design decision needed	1	0	0	0	0	0
