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:1 Changed 4 years ago by anonymous
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 4 years ago by anonymous
- Component changed from File uploads/storage to Documentation
- Triage Stage changed from Unreviewed to Accepted
comment:6 Changed 4 years ago by SmileyChris
- Easy pickings unset
- Summary changed from FileField's path attribute lacks 'upload_to' bit. to Document that the FileField's path can not be relied on until the model is saved
comment:7 Changed 3 years ago by poirier
- Owner changed from nobody to poirier
- Status changed from new to assigned
- UI/UX unset
Changed 3 years ago by poirier
comment:9 Changed 3 years ago by poirier
- Owner changed from poirier to nobody
- Status changed from assigned to new