Fixed bug in last commit

This commit is contained in:
Raphael Michel
2016-03-10 22:41:55 +01:00
parent 3d7dccb8fb
commit 80200157e3

View File

@@ -67,11 +67,7 @@ class SettingsForm(forms.Form):
)
else:
fname = '%s/%s.%s' % (self.obj.slug, name, value.name.split('.')[-1])
if not os.path.exists(os.path.dirname(fname)):
os.makedirs(os.path.dirname(fname))
with default_storage.open(fname, 'wb+') as destination:
for chunk in value.chunks():
destination.write(chunk)
default_storage.save(fname, value)
value._name = fname
elif isinstance(value, File):
# file is unchanged