Django Template - Cannot iterate throught this list
<p>I am passing this object to my template from my view with the name <code>student_collection</code></p>

<pre><code>&lt;class 'list'&gt;: [[31, 'John', âJacob', '1'], [31, 'Jeffrey', âMark', '2'], [39, âBorris', âHammer', '1']]
</code></pre>

<p>And accessing it as such in my template:</p>

<pre><code>{% for rows in student_collection %}
&lt;tr&gt;
    {% for items in rows %}

        {% for entry in items %}
        &lt;td&gt;{{ entry }}&lt;/td&gt;
        {% endfor %}

    {% endfor %}
&lt;/tr&gt;
{% endfor %}
</code></pre>

<p>I am getting an error at the point  <code>{% for entry in items %}</code> django says 'int' <code>object is not iterable</code> why is that I was expecting to iterate through <code>31,John,Jacob,1</code> . Any help in this regard would be appreciated.</p>

<blockquote>
  <p>I was expecting to iterate through <code>31,John,Jacob,1</code></p>
</blockquote>

<p>Then you wouldn't need that second inner loop. The first loop gives you each sublist/row in the list of rows, while the inner loop iterates through each row, producing each of the items/entries:</p>

<pre><code>{% for rows in student_collection %}
    &lt;tr&gt;
          {% for item in row %}
              &lt;td&gt;{{ item }}&lt;/td&gt;
          {% endfor %}
    &lt;/tr&gt;
{% endfor %}
</code></pre>

python django