title: loop values into divs in django template
body: <p>I have a table with 9 values. I want to loop through the table and put the results into a div structure in the template.</p>
  
  <p>I tried to <a href="https://docs.djangoproject.com/en/1.3/ref/templates/builtins/" rel="nofollow">cycle</a> through them, but I wasn't able to put them into different divs.</p>
  
  <p>The following works to put the same value in both places. How can I increment to the next group_nm?</p>
  
  <pre><code>{% for g in groups %}
  
      &lt;div class="left1"&gt;
              &lt;a href="/group/{{ g.group_nm }}"&gt;
          &lt;img src="/site_media/images/groups/{{ g.group_nm }}.gif" height="125px" width="200em" /&gt;
              &lt;/a&gt;
      &lt;p align="center"&gt;    
          &lt;font size="5" face="Georgia, Arial" color="maroon"&gt;
              {{ g.group_nm }}
          &lt;/font&gt;
      &lt;/p&gt;
      &lt;/div&gt;
  
      &lt;div class="left2"&gt;
              &lt;a href="/group/{{ g.group_nm }} "&gt;
          &lt;img src="/site_media/images/groups/{{ g.group_nm }}.jpg" height="125px" width="200em" /&gt;
              &lt;/a&gt;
      &lt;p align="center"&gt;          
          &lt;font size="5" face="Georgia, Arial" color="maroon"&gt;
              {{ g.group_nm }}
          &lt;/font&gt;
      &lt;/p&gt;         
      &lt;/div&gt;
  </code></pre>
  
  <p>Thanks.</p>
  
  <p>EDIT: I want to do this with 9 groups (eventually, in another place, I'll want to do it with an unlimited number). The above example only shows an example of 2 that are repeated.</p>