BK
Как у меня сейчас:
{% for gallery in photo_gallery %} # Здесь выводится список галерейв views.py у меня выглядит таким образом
{% for item in photo_gallery_before_after %} # Здесь должны выводиться фото которые принадлежат к этой галерее
{% endofor %}
{% end for %}
class PhotoGalleryListView(ListView):
model = PhotoGallery
template_name = 'gallery/photo_gallery.html'
def get_context_data(self, *, object_list=None, **kwargs):
context = super(PhotoGalleryListView, self).get_context_data(**kwargs)
context['consult_form'] = ConsultForm()
context['categories'] = Category.objects.filter(published=True)
context['photo_gallery'] = PhotoGallery.objects.filter(published=True)
context['photo_gallery_before_after'] = UploadPhoto.objects.all()
return context