class MyModel(models.Model)
image = models.FileField(upload_to="blagh blagh...")
#more spam...
I have a file in memory and I want to save it via Django FileField save method, like this:
photo.image.save(name, buffer) # second arg should be django File
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:
buffile = File(buffer, name) # first argument should be a file
photo.image.save(name, buffile)
But File methods use size and name fields of supplied file. StringIO doesn't define them. I've found this, but the link is dead