How To Use Django Cycle Tag
<p>This hopefully is a pretty easy question. My endgoal is to be able to view my database entries in a table which I can sort via the column headers. I have read the <a href="https://docs.djangoproject.com/en/1.9/ref/templates/builtins/#cycle" rel="noreferrer">documentation</a> on cycle tags, but don't know they mean by <code>'row1'</code> and <code>'row2'</code>:</p>

<pre><code>{% for o in some_list %}
    &lt;tr class="{% cycle 'row1' 'row2' %}"&gt;
        ...
    &lt;/tr&gt;
{% endfor %}
</code></pre>

<p>Secondly, how would I correctly implement it into my template? I am using a very simple <a href="http://www.kryogenix.org/code/browser/sorttable/" rel="noreferrer">JS library</a>, which will allow the sorting:</p>

<p>page.html</p>

<pre><code>{% if Variable %}
    &lt;table class="sortable"&gt;
        &lt;tr&gt;
            &lt;th&gt;Title 1&lt;/th&gt;
            &lt;th&gt;Title 2&lt;/th&gt;
            &lt;th&gt;Title 3&lt;/th&gt;
            &lt;th&gt;Title 4&lt;/th&gt;
            &lt;th&gt;Title 5&lt;/th&gt;
        &lt;/tr&gt;
    {% for stuff in Variable %}

        &lt;tr class="{% cycle 'stuff' %}"&gt;    
            &lt;td&gt;
                &lt;a href="{% url 'detail_page' stuff.id %}"&gt;
                {{ stuff.Name|capfirst }}&lt;/a&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    {% endfor %}
    &lt;/table&gt;
{% else %}
    &lt;p&gt;No Results Found&lt;/p&gt;
{% endif %}
</code></pre>

<p>my models.py in case you need it: </p>

<pre><code>def view(request):
    Variable = database.objects.all()
    context = {
        'Variable': Variable,
    }
    return render(request, 'app/page.html', context)
</code></pre>

<p><strong>EDIT:</strong> It seems I had the right code all along, just some unevenly applied CSS that made my table not look like a table. The cycle tag was not needed, only the for loop. It also looked better after adding another table row:</p>

<pre><code>{% for stuff in Variable %}
&lt;tr&gt;
    &lt;td&gt;{{ stuff.Name|capfirst }}&lt;/td&gt;
    &lt;td&gt;{{ stuff.Number|capfirst }}&lt;/td&gt;
&lt;/tr&gt;
{% endfor %}
</code></pre>