The problem I have is quite uncommon I think, because I didn\'t seem to be able to find an answer on here or on Google.
I have several pictures stored in my database and in
This was kind of not as complicated as I thought. (Which could explain why no one asked that question all over the internet I guess)
Using Python 3.3, your strings are unicode and you mainly work with unicode objects. File needs bytes data to work correctly so here is the solution :
zipname = "{}.zip".format(reporting.id, reporting.title)
with ZipFile(zipname, 'w') as zf:
# Generating the ZIP !
reporting = Reporting.objects.get(pk=reporting_id)
reporting.pictures_archive.delete()
reporting.pictures_archive = File(open(zipname, "rb"))
reporting.save()