Okay, this may not be the most efficient implementation, but it works:

  # create temporary file
  tmpfile = tempfile.TemporaryFile()
  *write to tmpfile*

  # wrap temporary file with django.core.files.File
  fileContents = django.core.files.File(tmpfile)
  fileContents.size = tmpfile.tell()  # admittedly, a bit of a hack
  
  # create and save new Model
  model = Chart(**kwargs)
  model.image.save(fn, fileContents)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ve5L7uRErOIJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to