Saturday, August 22, 2015

Re: Working with FileFields/FieldFiles

 
 
 
On Fri, Aug 21, 2015, at 14:28, Hugo Kitano wrote:
Hi, I'm a beginner with Django, and I'm trying to figure out how to work with FieldFiles.
 
One of my models has a FileField in which the user must submit a .bed file.  I use another library in python to analyze the .bed file.
The .bed file is saved to a specific directory on disk, and I want
 
file_on_disk = Bed('/Users/.../media/statistics.bed')
 
where statistics.bed is the name of the file, and media is the directory all files are saved to.  How would I construct this line of code?
 
Thanks!
 
You're probably after the upload_to argument of FileField, which let you define where files are saved:
 
 
(I assume you're already looked into MEDIA_ROOT):
 
 
--
Hugo Osvaldo Barrera
 

No comments:

Post a Comment