Skip to main content

A simple gallery app for Wagtail.

Project description

Wagtail Simple Gallery

Is an extension for Torchbox's Wagtail CMS for creating a simple image gallery either by creating a page using the template or a templatetag.

Current version works with Wagtail 2.5.x & Django 2.1.x.

Getting started

Install

  • Install via pip pip install wagtail-simple-gallery.
  • Add wagtail_simple_gallery to INSTALLED_APPS in your project settings.
  • Run python manage.py migrate wagtail_simple_gallery.

Use

  • Create a new collection in Wagtail CMS: Settings -> Collections.
  • Add or upload images to the collection.
  • Create a new page using the Simple Gallery Index template and select the new collection.
  • You are done, preview or publish the page and you should see the gallery in action.

Features / Options

  • Toggleable Lightbox for viewing images.
  • Show images from selected collection.
  • The amount of images shown on one page (before the paginator kicks in) is changeable.
  • A crude way to order the images shown on a gallery page. By default newest images are shown first, but this can be changed in the page content settings. If it's set to "Image title" then you can manually order images by inserting [<number>] into their title: "[00004] Cute cat".
  • Tags.

Settings

SIMPLE_GALLERY_TEMPLATE

You can override the SimpleGalleryIndex page template with this setting. Default: 'wagtail_simple_gallery/simple_gallery_index.html'

SIMPLE_GALLERY_ADMIN_URL_ROOT

You can use this with the Admin Interface if you use something other than "admin" for accessing the cms admin panel. Default: admin

Templatetags

{% load wagtailsimplegallery_tags %}

{% simple_gallery %} inclusion tag

Uses the template wagtail_simple_gallery/simple_gallery.html. You can use the simple-gallery style with this tag using: <link rel="stylesheet" href="{% static 'css/simple-gallery.css' %}">.

  • collection (default: None): Show images from this collection. Required, example: {% simple_gallery collection="Root" %}.
  • tags (default: None): Filter images by their tags. Example: {% simple_gallery tags="cats dogs" %}.
  • image_limit (default: None): Limit the amount of images to show. Example: {% simple_gallery image_limit=4 %}.
  • use_lightbox (default: True): Use lightbox for viewing images. Example: {% simple_gallery use_lightbox=False %}.

{% img|original_url %} filter

  • Takes wagtails Image object and returns its real original url instead of the one that wagtail creates. Example: /media/original_images/foo.jpg.

{% img.alt|hide_num_order %} filter

  • Hides the first occurance of [<number>] in the image title. E.g "[0010] Cute cat" -> "Cute cat"

Template

Look at simple_gallery_index.html template for an example or copy paste it and start modifying to make it look a part of your page. Your custom simple_gallery_index.html template should reside in /templates/wagtail_simple_gallery/simple_gallery_index.html

Or if simple_gallery_index.html is good enough for your use, then you can just create a simple_gallery_base.html in your own templates directory with the following content:

{% extends "base.html" %}

{% block content %}{% endblock %}

Admin Interface

The admin view for images is customized so it can show more images at once. By default there are 20 images on one page, but you can have 32 by adding path('', include('wagtail_simple_gallery.urls')), in your urls.py above the wagtailadmin_urls include which can be re_path(r'^admin/', include(wagtailadmin_urls)),. This requires wagtail version >= 1.6.3.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wagtail-simple-gallery-0.6.4.tar.gz (17.1 kB view hashes)

Uploaded Source

Built Distribution

wagtail_simple_gallery-0.6.4-py3-none-any.whl (22.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page