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.3.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

wagtailimagecaptions-0.2.3-py2.py3-none-any.whl (12.5 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for wagtailimagecaptions-0.2.3.tar.gz
Algorithm Hash digest
SHA256 bf2f9d217f0200aa587a9ef765c915663dcaaf05db1e062e478ec2802985e4d7
MD5 67bb6679848869ff2a464292f2bc1a31
BLAKE2b-256 d3ba271416e352470d9fbea033a0e6b66073262ce8e9748f53bcd4ea806e8366

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wagtailimagecaptions-0.2.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2daca2712bd9dea6691da4ba5b3b19ddfa3934d5ba245261b99a0a3335355807
MD5 79830372e57b3cef176d628283d3c110
BLAKE2b-256 14a48bf9b39be8ee62167c9498c8cd2730cc99060de74822a545969c43d3d67d

See more details on using hashes here.

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