Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Utter opened this issue Mar 7, 2024 · 0 comments
Labels
Type: Bug Something isn't working

Comments

@Utter
Copy link

Utter commented Mar 7, 2024

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

@Utter Utter added the Type: Bug Something isn't working label Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant