user233323
user233323

Reputation: 61

Django templates crashes with no sense

Hello I'm trying to use google visualization API along with django templates system. I got an error that don't know how to fix. The error is the following:

 invalid_block_tag
    raise self.error(token, "Invalid block tag: '%s'" % command)
django.template.TemplateSyntaxError: Invalid block tag: 'endfor'

The code is:

function drawChart() {
        var data = new google.visualization.DataTable();
        data.addColumn('date', 'time');
        data.addColumn('number', 'x');
        data.addColumn('number', 'y');
        data.addColumn('number', 'z');
        data.addRows([
        {% for d in datos &}
        [new Date({{d.instante|date:"Y, m, d, H, i, s"}}), {{d.x}}, {{d.y}}, {{d.z}}]
        {% if not forloop.last %},{% endif %}
        ]);
        {% endfor %}
        var chart = new google.visualization.AnnotatedTimeLine(document.getElementById('chart_div'));
        chart.draw(data, {displayAnnotations: true});
      }

Thanks you all!

Upvotes: 0

Views: 346

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799062

You goofed your for tag:

{% for d in datos %}

Upvotes: 2

Related Questions