Document that the FileField's path can not be relied on until the model is saved
|Reported by:||anonymous||Owned by:||nobody|
|Severity:||Normal||Keywords:||storage system path upload_to|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The FileField's .path attribute misses the path given in 'upload_to'.
MEDIA_ROOT = '/somewhere/'
In some model:
data = models.FileField(upload_to='files')
In the view that handles the file upload:
This prints '/somewhere/filename' but if I am correct it shall print '/somewhere/files/filename'
Exact Version is 1.2.5(-1) (current version in debian/wheezy)
upload_to='files/' does not remedy this issue.
I sincerely hope that I am not wasting your time.
Change History (11)
comment:2 Changed 6 years ago by
|Component:||File uploads/storage → Documentation|
|Triage Stage:||Unreviewed → Accepted|
comment:6 Changed 6 years ago by
|Summary:||FileField's path attribute lacks 'upload_to' bit. → Document that the FileField's path can not be relied on until the model is saved|
comment:7 Changed 5 years ago by
|Owner:||changed from nobody to Dan Poirier|
|Status:||new → assigned|