#5966 closed (wontfix)
FileField doesn't clean up directory after deletion
Reported by: | Michiel_1981 | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | fs-rf-docs | |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If a FileField file is being deleted it doesn't clean up a empty directory that might occur after deletion.
This is only a issue if you use a dynamic path based on date.
If this is the case then you could create a lot of empty directories and/or nested empty directories.
Example code:
class MetaFile(models.Model): file = models.FileField(_("File"), max_length=255, upload_to='meta/%y/%m')
Change History (10)
comment:1 by , 17 years ago
Keywords: | fs-rf added |
---|
comment:2 by , 17 years ago
Keywords: | fs-rf-docs added; fs-rf removed |
---|
comment:3 by , 17 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:4 by , 17 years ago
For what it's worth, when I added fs-rf-docs
to this, it meant that my work on #5361 will make this behavior possible, but it won't be inclued by default. Instead, its documentation will show what hooks are available to make this happen. I'd also rather not see this behavior, but at least #5361 will make it possible for those who would like it. Just in case that helps with the design decision.
comment:5 by , 17 years ago
for what it's worth, I override the FileField and add a dispather call to it for clean up if needed.
This ticket can be closed as you could override the delete method on the model or the above method.
I'll post on djangosnippets.org how this could be done if anybody is interested
comment:6 by , 16 years ago
milestone: | → 1.0 beta |
---|
comment:8 by , 16 years ago
milestone: | post-1.0 → 1.0 beta |
---|
Bugs aren't the only things planned for 1.0 beta. This is being addressed as part of #5361, which is planned to make it into 1.0 beta. Even though it won't be fixed directly, the behavior requested in this ticket will be quite possible once that goes in. Per Jacob, all such related tickets should be placed in the 1.0 beta milestone.
comment:9 by , 16 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
File storage is in as of [8244], so I'm marking this as wontfix -- as Marty says, it's very easy to write a custom file storage backend that works exactly how you like it.
Why should an empty folder be delete after a file is deleted? I think that should be an individual design decision. However, a Django design decision is required.