{% for img in strap.strapimage_set.all %} {% if img.url %} {% endif %} {{img.caption}} {% if img.url %} {% endif %} {% endfor %}