Chartjs-How can I add a django array element into a js array using an if condition

0👍

I put ‘ing1, ‘ing2’ and ‘ing3’ into a list called ‘title’ inside my views , then put that list into the context , then did the following inside the chart.js script :

{% for item in title %} '{{ item }}', {% endfor %}

now it adds the correct data to the labels array.

Leave a comment