Todo app for displaying a list of tasks The main view in my (toy!) Todo app is, of course, to display the list of tasks.  These are grouped by some criterion, and the tasks structure below is actually a list of pairs (header, list of tasks).

{% for tasks in tasks %}
    &lt;p class="list-header"&gt;{{ tasks.0 }}:&lt;/p&gt;
    &lt;ul&gt;
    {% for t in tasks.1 %}
        &lt;li&gt;
            &lt;span class="
                {% if t.priority &gt;= 1 %}prio-medium{% endif %}
                {% if t.priority &gt;= 2 %}prio-high{% endif %}
                "&gt;
                {{ t.description }}
            &lt;/span&gt;
            {% if t.due_date %}
                due, 
                &lt;span class="
                    {% if t.days_to_due_date &lt; 15 %}date-soon{% endif %}
                    {% if t.days_to_due_date &lt; 3 %}date-very-soon{% endif %}
                    {% if t.days_to_due_date &lt; 0 %}date-overdue{% endif %}
                    "&gt;
                    {{ t.relative_due_date }}
                &lt;/span&gt;
            {% endif %}
            - 
            {% if not t.done %}
                &lt;a href="/yata/{{ t.id }}/mark_done/"&gt;Done!&lt;/a&gt;
            {% else %}
                &lt;a href="/yata/{{ t.id }}/mark_not_done/"&gt;Not done!&lt;/a&gt;
            {% endif %}
            - 
            &lt;a href="/yata/{{ t.id }}/edit/"&gt;Edit&lt;/a&gt;
        &lt;/li&gt;
    {% endfor %}
    &lt;/ul&gt;
{% empty %}
    &lt;p class="list-header"&gt;Cool! Nothing to do...&lt;/p&gt;
{% endfor %}


In particular, I'm wondering if deciding which CSS class to assign is considered to be the view function's role, or if it's correct to put it in the template.

Similarly, I'm also wondering about the presence of several URLs in the template. Would they be better in the tasks structure itself?  Or should they be provided through some methods in the Task class? After all, relative_due_date is already a function that's only used for display (it returns a string like 'Yesterday', 'Tomorrow' or 'In 3 days'). And shouldn't I use reverse()?
I would suggest moving the CSS selection logic to a custom template tag or even a filter, e.g. &lt;span class="{{ t|due_date_color }}"&gt;{{ t.relative_due_date }}&lt;/span&gt;. After that your templates will look much cleaner and that logic would still belong to the presentation part of MVT (Model, View, Template).
You can split your tuple in the definition of the loop so that you don't redefine the tasks variable. {% for header, task_list in tasks %} .... 
Use reverse URLs, no question about it. You'd hate the day you have to change them otherwise :) Go even further, use URL namespaces.