text can be empty too

This commit is contained in:
j 2017-03-12 14:50:13 +02:00
parent 62ffbca208
commit 4733dc8994

View file

@ -352,7 +352,10 @@ class Document(models.Model):
elif key == 'rightslevel': elif key == 'rightslevel':
setattr(self, key, int(data[key])) setattr(self, key, int(data[key]))
elif ktype == 'text': elif ktype == 'text':
self.data[key] = ox.sanitize_html(data[key]) if data[key]:
self.data[key] = ox.sanitize_html(data[key])
else:
del self.data[key]
elif ktype == '[text]': elif ktype == '[text]':
self.data[key] = [ox.sanitize_html(t) for t in data[key]] self.data[key] = [ox.sanitize_html(t) for t in data[key]]
elif ktype == '[string]': elif ktype == '[string]':