title: Jinja / Django for loop range not working
body: <p>I'm building a django template to duplicate images based on an argument passed from the view; the template then uses Jinja2 in a for loop to duplicate the image.</p>
  
  <p>BUT, I can only get this to work by passing a list I make in the view.  If I try to use the jinja range, I get an error ("Could not parse the remainder: ...").</p>
  
  <p>Reading <a href="https://stackoverflow.com/questions/48595150/range-not-working-in-for-loop">this link</a>, I swear I'm using the right syntax.</p>
  
  <p><strong>template</strong></p>
  
  <pre><code>{% for i in range(variable) %}
      &lt;img src=...&gt;
  {% endfor %}
  </code></pre>
  
  <p>I checked the variable I was passing in; it's type int.  Heck, I even tried to get rid of the variable (for testing) and tried using a hard-coded number:</p>
  
  <pre><code>{% for i in range(5) %}
      &lt;img src=...&gt;
  {% endfor %}
  </code></pre>
  
  <p>I get the following error: </p>
  
  <blockquote>
    <p>Could not parse the remainder: '(5)' from 'range(5)'</p>
  </blockquote>
  
  <p>If I pass to the template a list in the arguments dictionary (and use the list in place of the range statement), it works; the image is repeated however many times I want.</p>
  
  <p><strong>What am I missing?</strong>  The docs on Jinja (<a href="http://jinja.pocoo.org/docs/2.10/templates/#for" rel="nofollow noreferrer">for loop</a> and <a href="http://jinja.pocoo.org/docs/2.10/templates/#list-of-global-functions" rel="nofollow noreferrer">range</a>) and the previous link all tell me that this should work with range and a variable.</p>