diff --git a/xls2ddl/tmpls.py b/xls2ddl/tmpls.py index 87d73e4..3869bf1 100644 --- a/xls2ddl/tmpls.py +++ b/xls2ddl/tmpls.py @@ -149,7 +149,7 @@ if not ns.get('sort'): {% if type(sortby) == type("") %} ns['sort'] = '{{sortby}}' {% else %} - ns['sort'] = json.loads({{json.dumps(sortby)}}) + ns['sort'] = json.loads('{{json.dumps(sortby)}}') {% endif %} {% else %} ns['sort'] = 'id' @@ -160,7 +160,7 @@ ns['sort'] = '{{relation.outter_field}}_text' sql = '''{{sql}}''' {% if not relation %} {% if data_filter %} -filterjson = json.loads({{json.dumps(data_filter, ensure_ascii=False)}}) +filterjson = json.loads('{{json.dumps(data_filter, ensure_ascii=False)}}') {% else %} filterjson = None fields_str=r'''{{json.dumps(fields, indent=4, ensure_ascii=False)}}''' @@ -450,7 +450,7 @@ async with db.sqlorContext(dbname) as sor: } } {% endif %} - tblfields = json.loads({{json.dumps(fields, ensure_ascii=False)}}) + tblfields = json.loads('{{json.dumps(fields, ensure_ascii=False)}}') tblfname = [ f['name'] for f in tblfields ] other_keys = [ k for k in ns.keys() if k in tblfname and k != 'id' ] if len(other_keys) > 0: