Manually add image to filefield in save method on modelform

12 views
Skip to first unread message

Andreas Kuhne

unread,
Jun 22, 2015, 3:56:38 PM6/22/15
to django...@googlegroups.com
Hi all,

I have created a modelform that has an Imagefield in it. I want to override the save function and manually create a filefield with an image that already exists in the file storage (S3). So the things I have to do would be:

* Download the image from S3 and save it to a temporary file
* Create a TemporaryUploadedFile and add it the the cleaned_data dictionary.
* Continue with the save method. 

This should upload the file again and then connect the file to the model.

Has anyone done this before and could point me in the correct direction on howto create the TemporaryUploadedFile object?

Regards,

Andréas
Reply all
Reply to author
Forward
0 new messages