Possible Duplicate:
How to assign a local file to the FileField in Django?
I was trying to assign a file from my disk to the FileField, but I have this error:
AttributeError: 'file' object has no attribute 'open'
My python code:
pdfImage = FileSaver()
myPdfFile = open('mytest.pdf')
pdfImage.myfile.save('new', myPdfFile)
and my models.py
class FileSaver(models.Model):
myfile = models.FileField(upload_to="files/")
class Meta:
managed=False
Thank you in advance for your help