from django.core.files.base import ContentFile, File
from django.core.files.storage import FileSystemStorage
from django.utils.deconstruct import deconstructible
+from django.utils.encoding import force_bytes
@deconstructible
return ContentFile(decompress(text))
def _save(self, name, content):
- content = ContentFile(compress(content.read()))
+ data = force_bytes(content.read())
+ content = ContentFile(compress(data))
return super(GzipFileSystemStorage, self)._save(name, content)