1👍
✅
It looks like your plural are in the wrong spot:
{% for post_images in post.sellpostimage_set.all %}
should be:
{% for post_image in post.sellpostimage_set.all %}
post_image = SellPostImage.objects.filter(post=poster_posts)
context_dict['post_image'] = post_image
should be:
post_images = SellPostImage.objects.filter(post=poster_posts)
context_dict['post_images'] = post_images
or:
post_image = SellPostImage.objects.get(post=poster_posts)
context_dict['post_image'] = post_image
why do you do this in your template:
{% for post_images in post.sellpostimage_set.all %}
if you have post_images
in the context?
How does this work?
<img class="thumbnail" src="{{ post_images.pictures.url }}" />
shouldn’t it be:
<img class="thumbnail" src="{{ post_image.picture.url }}" />
Source:stackexchange.com