I have a model that has an ImageField. How can I manually assign an imagefile to it? I want it to treat it like any other uploaded file...
+5
A:
See the django docs for django.core.files.File
Where fd is an open file object:
model_instance.image_field.save('filename.jpeg', fd.read(), True)
null
2009-05-01 13:13:40
It works! Thanks
Jack Ha
2009-05-09 12:44:14