{% for teacher in teachers %} {{ teacher.short_name|default:teacher.full_name }}{% if not forloop.last %},{% endif %} {% endfor %}