0

I installed photologue correctly in my project (blog) and I can add images in admin panel, but how to display them on my main page?

meowz
  • 3
  • 1
  • 4

2 Answers2

0

In the admin panel, you also need to:

  1. Create a gallery.
  2. Choose which photos are a part of which galleries.
0

For one of my projects, I created a product model had a foreign key linked to a Gallery:

    gallery = models.ForeignKey(Gallery, blank=True, related_name='gallery')

The issue in the template is that you cannot iterate over a Gallery or Photo from Photologue. I had to call product.gallery.photos.all() in order to iterate over the collection of images in my gallery.

To get the url of the image to link to the src of an <img> tag, you can just run (if you're iterating):

    for image in product.gallery.photos.all():
        {{ image.url }}

Hope this helps!

jShiohaha
  • 1
  • 1