pwa: adapt file support for django 1.8

This commit is contained in:
Frédéric Péters 2019-01-03 12:35:14 +01:00
parent d9367275de
commit 8faa42d002
1 changed files with 2 additions and 1 deletions

View File

@ -19,6 +19,7 @@ import json
from django.conf import settings
from django.core import serializers
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
from django.db import models
from django.utils import six
@ -133,7 +134,7 @@ class PwaNavigationEntry(models.Model):
decoded_icon = decode(force_bytes(json_entry['icon:base64']))
if not default_storage.exists(entry.object.icon.name) or entry.object.icon.read() != decoded_icon:
# save new file
entry.object.icon.save(entry.object.icon.name, BytesIO(decoded_icon))
entry.object.icon.save(entry.object.icon.name, ContentFile(decoded_icon))
class PushSubscription(models.Model):