我想显示画廊列表(画廊名称和第一张图片),如下所示:
{% for gallery in galleries %}
<a href="/gallery/{{ gallery.slug }}">
<div class="gallery_box">
<h2>{{ gallery.translatedName }}</h2>
<img src="{{ (gallery.image_set.all|first).path }}"/>
</div>
</a>
{% endfor %}
但
{{ (gallery.image_set.all|first).path }}
是无效的。如何访问属性“路径”
{{ gallery.image_set.all|first }}