I need to add to the array Java Script informations from Python list
list.py
workflows = [{"date": '2012', "rate": 5}, {"date": '2011', "rate": 4}]
return render_template('modules/general/backoffice/rating.html', workflows=workflows)
rating.html
{% block module_scripts %}
<script>
$(function () {
"use strict";
// LINE CHART
var line = new Morris.Line({
element: 'line-chart',
resize: true,
data: [
{% for workflow in workflows %}
{time: {{ workflow.date }}, rate: {{workflow.rate}} }
{% endfor %}
],
xkey: 'time',
ykeys: ['rate'],
labels: ['Rate'],
lineColors: ['#3c8dbc'],
hideHover: 'auto'
});
});
</script>
{% endblock %}
But it does not work.
I've seen a lot of posts about my problem, but they are not suitable.
One of them Django FOR LOOP in JavaScript