전망 :템플릿에서 첫 번째 객체 만 가져 오는 방법은 무엇입니까?
....
d = Data.objects.filter(is_accepted=True)
....
템플릿 :
{% for item in d %}
{% for picture in item.photo_set.all %}
<img class="image" src="{{ picture.photo.url}}">
{% endfor %}
{% endfor %}
방법 만 처음 사진을 얻을? ({{ picture.photo.url}}
)
내 솔루션보다 깔끔합니다. +1. –