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...
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With