I need to concatenate the variable name from a template variable and hand it to the json_script template tag.
I tried:
{% with sensorname|add:"-data" as SensorNameData %}
{{ values|json_script:SensorNameData }}
output: {{ SensorNameData }}
{% endwith %}
Which did not work, so I created a filter templatetag:
@register.filter
def combined(str1, str2):
return f"""{str1}{str2}"""
and tried:
{{ values|json_script:sensorname|combined:"-data" }}
but when applying it, I end up with the parsed list of values and then -data. Can I somehow tell the template processor to validate sensorname first and then values|json_script:xxx?