title: a StringIO like class, that extends django.core.files.File
body: <pre><code>class MyModel(models.Model)
   image = models.FileField(upload_to="blagh blagh...")
   #more spam...
  </code></pre>
  
  <p>I have a file in memory and I want to save it via Django FileField save method, like this:</p>
  
  <pre><code>photo.image.save(name, buffer) # second arg should be django File
  </code></pre>
  
  <p>I've tried to use StringIO, but it doesn't extend django.core.files.File and thus doesn't implement method chunks(). I've wrapped it in a File object like that:</p>
  
  <pre><code>buffile = File(buffer, name) # first argument should be a file
  photo.image.save(name, buffile)
  </code></pre>
  
  <p>But File methods use size and name fields of supplied file. StringIO doesn't define them.
  I've found <a href="https://stackoverflow.com/questions/141449/how-do-i-wrap-a-string-in-a-file-in-python/143532#143532">this</a>, but the link is dead</p>