Skip to main content

Wagtail Photo Gallery

With this extention you are just a few steps away from a simple photo gallery for your wagtail page.

wagtail-photo-gallery adds easy photo management to wagtail.

The gallery is configurable with the wagtail admin panel and is suited for large amounts of photos.

The key idea of this package is to store and manage photos independently of the usual wagtail images. Instead, all photos are assigned to albums and can be managed by a drag-and-drop sorting widget (which also supports item selection for mass-dragging and deletion).

To organize your photos, a Collection is assigned to each album, by default the Root Collection is used. Embedding the photo gallery within a StreamField is now done by adding a GalleryBlock with reference to the desired Collection.

Installation

pip install wagtail-photo-gallery[pillow]
# or
pip install wagtail-photo-gallery[pillow-simd]

If you need the fastest possible image uploading (Faster resizing) use pillow-simd.

Settings

Add the following to your settings (base.py):

INSTALLED_APPS = [
    #...
    'wagtail_photo_gallery',
    'wagtail.contrib.routable_page',
    #...
]

Update your database structure using (remember to create a backup first):

./manage.py migrate

Example

Once you've installed this addon and configured the settings as above, all you need to do is to inherit from ImageGalleryMixin and to add GalleryBlock to your StreamField.

# models.py

from wagtail.models import Page
from wagtail.fields import StreamField

from wagtail.admin.panels import FieldPanel

from wagtail_photo_gallery.blocks import GalleryBlock
from wagtail_photo_gallery.mixins import ImageGalleryMixin

class YourWagtailPage(ImageGalleryMixin, Page):
    
    content = StreamField([
        #...
        ("gallery", GalleryBlock()),
        #...
    ], blank=True)
    
    # content panel for the CMS (same as always)
    content_panels = Page.content_panels + [
        FieldPanel("content"),
    ]

If you want to use the pre-defined CSS-flexbox layout for the albums, you need to include the following css code in your gallery page (YourWagtailPage)

{% include 'wagtail_photo_gallery/extra_css.html' %}

Minimal template example

{% extends "base.html" %}

{% load wagtailcore_tags %}
{% load static %}

{% block body_class %}template-homepage{% endblock %}

{% block content %}
    {% for block in page.content %}
        {% include_block block %}
    {% endfor %}
{% endblock content %}

{% block extra_css %}
    {% include 'wagtail_photo_gallery/extra_css.html' %}
{% endblock %}

Metadata

Release files for wagtail-photo-gallery 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wagtail-photo-gallery 0.2.0
File Size Uploaded Provenance Actions
wagtail_photo_gallery-0.2.0.tar.gz 35.4 kB Without provenance Details for wagtail_photo_gallery-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wagtail-photo-gallery 0.2.0
File Interpreter ABI Platform Actions
wagtail_photo_gallery-0.2.0-py3-none-any.whl Python 3 none any Details for wagtail_photo_gallery-0.2.0-py3-none-any.whl

Total release size: 96.2 kB

Security for wagtail-photo-gallery 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page