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