var lineData = {
labels : [
{% for item in labels %}
"{{ item }}",
{% endfor %}
],
I am getting an error in the for loop. I am not sure where I am going wrong with the syntax.
CodePudding user response:
You can pass data to JavaScript within a template using the jinja filter tojson
.
var lineData = {
labels : {{ labels | tojson }},
// ...
}