coderedcorp/coderedcms

ImageGalleryBlock() returns no values / doesn't display photos in a Collection

Utter opened this issue · 1 comments

Describe the bug

Developing on POP_OS (Ubuntu) with Python 3.10

ImageGalleryBlock() has no output when used in a page model using the following:

image_gallery = StreamField([
	('image_gallery', ImageGalleryBlock()),
],
    verbose_name="Choose images for the gallery",
    null=True,
    use_json_field=True )

Steps to reproduce

Create a page model using the ImageGalleryBlock
Add the block tags to the page template using the following:

      {% for block in page.image_gallery %}
      {% include_block block %}
      {% endfor %}

On the designated page in admin, use the fieldpanel to select a Collection and save

Expected behavior

The images in the collection should appear and be clickable to pop up in a modal

Additional context

In the block template, If I output the value of {{self.collection.id}} I get the correct Collection number (2 in my case) but if I output {{pictures}} I simply get <ImageQuerySet []> from which I presume the image URLs aren't being passed to the pictures list.

Outputting {{ block.value }} in the page template I get:

StructValue([('settings', StructValue([('custom_template', ''), ('custom_css_class', ''), ('custom_id', '')])), ('collection', <Collection: Locos and Vehicles>)])

Have I set the model up incorrectly or borked something in the template?

Thanks in advance for any help

Closed by #625