{% for category, insts in idplist %} {% for inst in insts %} {% ifequal inst.id selected.id %} {% else %} {% endifequal %} {% endfor %} {% endfor %}