{% for anc in ancestors %} {% if forloop.last and forloop.counter > 1 %} {# skip last one #} {% else %}