There is a Django template in my web app which has a JavaScript section in it.
chart.html
{% block footer_javascript_section %}<script type="text/javascript" >
g = new Dygraph(
// containing div
document.getElementById("graphdiv"),
// CSV or path to a CSV file.
"{{ biogas_plant_str }}",
{width: 1000,
height: 400,
labels: {{biogas_plant_list}} } /* <---- THIS list */
);
</script>
{% endblock footer_javascript_section %}
I've passed in a Python list in the context of the chart view function.The list is referred by biogas_plant_list.
The issue
I need to embed the Python list as it is, without splitting or iterating over it. Other questions similar to this one, required the list to be handled in some way. A list has to be output after substitution.
['s1','s2']
However template substitutes the HTML character entities instead of the actual decoded characters. How to turn it off?
['"25.7\\n"', '"26.3\\n"' ]