Chartjs-Django – rendering two dimensional dictionary data to template

1👍

You can’t do list manipulation in a template. It’s not quite clear what you want to do, but looks like you just need to pass the values of each inner dict to your JS function.

{% for key, value in vote_records.items %}
        {
                label: '# for Vote',
                data: {{ value.values }},
                backgroundColor: [
                'rgba(255, 99, 132, 0.2)',
                ],
                borderColor: [
                'rgba(255,99,132,1)',
                ],
                borderWidth: 1
        },
{% endfor %}

Leave a comment