Django FileField appending temporary path name to media_root path on save
The problem lies in the to_upload method, I was getting filename and using it as it came.
The fix was to do: filename = os.path.basename(filename) and use that
I have this custom ModelAdmin that unzips the uploaded file to /tmp and the sets the unzipped file to a FileField in a model doing mymodel.myfilefield = File(open(path_to_file))
The thing is that after doing that the new file is copied to <MEDIA_ROOT>/<upload_to>/tmp/<filename>
And that's not desired. Why is appending the 'tmp' path?
Thanks