Jinja range raises TemplateSyntaxError in Django view
<p>In a django jinja2 tempate with the code</p>

<pre><code>{% for i in range(10) %}
    foo {{ i }}&lt;br&gt;
{% endfor %}
</code></pre>

<p>a <code>TemplateSyntaxError</code> is raised with the error message</p>

<blockquote>
  <p>Could not parse the remainder: '(10)' from 'range(10)'</p>
</blockquote>

<p>What do I need to do in order to loop over a <a href="http://jinja.pocoo.org/docs/dev/templates/#range" rel="nofollow">range</a> in a jinja2 template.</p>

<p>I found a <a href="https://docs.djangoproject.com/en/1.8/ref/templates/language/#accessing-method-calls" rel="nofollow">link</a> in the django documentation explaining that </p>

<blockquote>
  <p>Because Django intentionally limits the amount of logic processing available in the template language, it is not possible to pass arguments to method calls accessed from within templates. Data should be calculated in views, then passed to templates for display.</p>
</blockquote>

<p>but I don't think that this applies to the range function.</p>

<p>Django is not using Jinja2, but the Django template language. There is no range function in the Django template language.</p>

python django range jinja2