title: django template question (accessing a list)
body: <p>I am writing a template for my first django website.</p>
  
  <p>I am passing a list of dictionaries to the template in a variable. I also need to pass a few other lists which hold boolean flags. (Note: all lists have the same length)</p>
  
  <p>The template looks something like this:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;&lt;title&gt;First page&lt;/title&gt;&lt;/head&gt;&lt;body&gt;
          {% for item in data_tables %}
          &lt;table&gt;
          &lt;tbody&gt;
                    &lt;tr&gt;&lt;td colspan="15"&gt;
                    {% if level_one_flags[forloop.counter-1] %}
                    &lt;tr&gt;&lt;td&gt;Premier League
                    {% endif %}
                    &lt;tr&gt;&lt;td&gt;Junior league
                    &lt;tr&gt;&lt;td&gt;Member count
                    {% if level_two_flags[forloop.counter-1] %}
                    &lt;tr&gt;&lt;td&gt;Ashtano League
                    {% endif %}
               &lt;/tbody&gt;
          &lt;/table&gt;
          {% endfor %}
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I am getting the following error:</p>
  
  <blockquote>
    <p>Template error</p>
    
    <p>In template /mytemplate.html, error at
    line 7 Could not parse the remainder:
    '[forloop.counter-1]' from
    'level_one_flags[forloop.counter-1]'</p>
  </blockquote>
  
  <p>I am, not suprised I am getting this error, since I was just trying to see if would work. So far, from the documentation, I have not found out how to obtain the items in a list by index (i.e. other than by enumeration).</p>
  
  <p>Does anyone know how I may access a list by index in a template?</p>