Skip to main content

A Django app for extending the Wagtail Image model to add captions and alt fields as

Project description

Captions for Wagtail Images

A Django app for extending the Wagtail Image model to add captions and alt fields as well as the extraction of IPTC image meta data.

screenshot

Installing

Install using pip:

pip install wagtailimagecaptions

Settings

In your settings file, add wagtailimagecaptions to INSTALLED_APPS:

INSTALLED_APPS = [
    # ...
    "wagtailimagecaptions",
    # ...
]

You will also need to set a custom Image model in your setting files:

# settings.py
WAGTAILIMAGES_IMAGE_MODEL = "wagtailimagecaptions.CaptionedImage"

Migrating

Heads up! If you have existing images, you will need to create a data migration operation to move the old images into the new model.

How to Use

The custom Image model, CaptionedImage, adds four new fields to the Wagtail Image model: alt, caption, credit, iptc_data. When a new image is uploaded via Wagtail's media library, the app will attempt to extract any IPTC meta data found in the file and fill the alt, caption and credit fields. All IPTC meta data extracted is also stored in iptc_data.

Example use in a template:

{% load wagtailcore_tags %}

<img src="{{ image.url }}" alt="{{ image.alt }}">{{ image.caption|richtext }}

Adding date paths to image uploads.

To add date paths to the image upload path, you can set WAGTIALIMAGECAPTIONS_UPLOAD_TO_DATE_PATH in your Django settings file with a valid date format.

# settings.py
WAGTIALIMAGECAPTIONS_UPLOAD_TO_DATE_PATH = "%Y/%m"

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

wagtailimagecaptions-0.2.5.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wagtailimagecaptions-0.2.5-py2.py3-none-any.whl (12.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file wagtailimagecaptions-0.2.5.tar.gz.

File metadata

  • Download URL: wagtailimagecaptions-0.2.5.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for wagtailimagecaptions-0.2.5.tar.gz
Algorithm Hash digest
SHA256 d4a105a0c2c3ee2d78fd3bfddf1c461656bdf4f00af3fee7d455b3ec14777226
MD5 6325d95b21e214667c97e2325d1d9b42
BLAKE2b-256 afe009c8b3c19fe3b94d4a107e08e8f0900ebabf23e600ff4fe76905da52d347

See more details on using hashes here.

File details

Details for the file wagtailimagecaptions-0.2.5-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for wagtailimagecaptions-0.2.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1b9b776ba084adab2cef8c0f93f20856ba9c617bf131738378e1334d79778901
MD5 79ffe5681adc6a03b0726b4ac8039593
BLAKE2b-256 eefc24c098b625647214fd9217d14359d12d4d8b04c6776da43c728160bdd63c

See more details on using hashes here.

Supported by

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