Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django Invalid Block Tag: 'endfor', expected 'endblock'

What could be the cause of the this TemplateSyntaxError in Django?

Invalid block tag: 'endfor', expected 'endblock'

My template is pretty simple so far:

{% extends 'base.html' %}
{% block content %}
    <div id='beerslist'>
        {$ for beer in beers %}
        {{ beer }}
        {% endfor %}
    </div>
{% endblock %}

After looking at the traceback list, the 'beer' variable exists and is returning an array. How can I fix this syntax error?

like image 864
Nick B Avatar asked Apr 21 '12 22:04

Nick B


1 Answers

{$ for beer in beers %}

You typed a $ instead of %. That's why it doesn't recognize the for and complains that there's no for block for it to close when it sees the endfor.

like image 161
sepp2k Avatar answered Sep 29 '22 08:09

sepp2k