fix quotes in project titles(more)

This commit is contained in:
j 2023-11-17 11:28:39 +01:00
parent b82440df24
commit ee11e6b7e1

View file

@ -256,6 +256,7 @@ class Item(models.Model):
description = data.pop(key) description = data.pop(key)
if isinstance(description, dict): if isinstance(description, dict):
for value in description: for value in description:
value = ox.sanitize_html(value)
d, created = Description.objects.get_or_create(key=k, value=value) d, created = Description.objects.get_or_create(key=k, value=value)
d.description = ox.sanitize_html(description[value]) d.description = ox.sanitize_html(description[value])
d.save() d.save()
@ -704,7 +705,7 @@ class Item(models.Model):
for d in Description.objects.filter(key=key, value__in=values): for d in Description.objects.filter(key=key, value__in=values):
i['%sdescription' % key][d.value] = d.description i['%sdescription' % key][d.value] = d.description
else: else:
values = ox.sanitize_html(self.get(key, '')) value = ox.sanitize_html(self.get(key, ''))
qs = Description.objects.filter(key=key, value=value) qs = Description.objects.filter(key=key, value=value)
i['%sdescription' % key] = '' if qs.count() == 0 else qs[0].description i['%sdescription' % key] = '' if qs.count() == 0 else qs[0].description
if keys: if keys: