views:

59

answers:

2
{% for d in mydata %}
    {{ d.title }}
{% endfor %}

However, I would like the first one to be bolded. How can I use the loop to say...if the d is the first one, then bold it?

+2  A: 

Check if forloop.first is true.

Ignacio Vazquez-Abrams
+8  A: 

Check out http://docs.djangoproject.com/en/dev/ref/templates/builtins/#for. Looks like:

{% for d in mydata %}
    {% if forloop.first %}
        <strong>{{ d.title }}</strong>
    {% else %}
        {{ d.title }}
    {% endif %}
{% endfor %}
Bialecki