From 0f530f4437dd7e6d16526b1a0233d4b5dce86feb Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 13 Nov 2020 16:11:44 +0100 Subject: Templates: fix VALUES generation --- ishtar_common/models.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'ishtar_common/models.py') diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 89bee27cd..bba04488b 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -196,7 +196,7 @@ class ValueGetter(object): val = '' elif (key in self.GET_VALUES_EXTRA_TYPES or "type" in key) and ( val.__class__.__name__.split('.')[0] == 'ManyRelatedManager'): - val = u" ; ".join([str(v) for v in val.all()]) + val = " ; ".join([str(v) for v in val.all()]) elif isinstance(val, (tuple, list, dict)): pass else: @@ -214,13 +214,6 @@ class ValueGetter(object): value_list.append((key, str(values[key]))) for global_var in GlobalVar.objects.all(): values[global_var.slug] = global_var.value or "" - if not filtr or 'VALUES' in filtr: - values['VALUES'] = json.dumps( - values, indent=4, sort_keys=True, - skipkeys=True, ensure_ascii=False, - separators=("", " : "), - ).replace(" " * 4, "\t") - return values @classmethod @@ -1459,7 +1452,14 @@ class DocumentTemplate(models.Model): ] ) """ + filtr = [] values = c_object.get_values() + if not filtr or 'VALUES' in filtr: + values['VALUES'] = json.dumps( + values, indent=4, sort_keys=True, + skipkeys=True, ensure_ascii=False, + separators=("", " : "), + ).replace(" " * 4, "\t") engine = IshtarSecretaryRenderer() try: result = engine.render(self.template, **values) -- cgit v1.2.3