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.4.tar.gz (12.1 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.4-py2.py3-none-any.whl (12.6 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

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

File hashes

Hashes for wagtailimagecaptions-0.2.4.tar.gz
Algorithm Hash digest
SHA256 fc7ed20e8c92a82fa1c9e68b30515e53fb13f2fd520f995c56ce748b6a4a24b0
MD5 2dd15f8d43fcf4f7d96ac687508423f1
BLAKE2b-256 b0ef0529847975428a6e1b3770dd8d4685e2c920938900b814b8de7af3653ec6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wagtailimagecaptions-0.2.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1284f4306ce2781f6881f451c7e70a260463ddba51bc8512ed323494493a0f15
MD5 242067948632b5e58a435546ac8e814c
BLAKE2b-256 3cde1e863e028254101dfafce5bfacd8f13ab0c31f9ac59c1cca1e65ec918148

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