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 WAGTAILIMAGECAPTIONS_UPLOAD_TO_DATE_PATH in your Django settings file with a valid date format.

# settings.py
WAGTAILIMAGECAPTIONS_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.6.tar.gz (12.4 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.6-py2.py3-none-any.whl (12.8 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

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

File hashes

Hashes for wagtailimagecaptions-0.2.6.tar.gz
Algorithm Hash digest
SHA256 8bf3d278be3d0e35cce031ad3ea07771cb86d5e7c1c2492a6a048d86b2ffb83f
MD5 3b47a9add665ddce7b8e06ea0fff44fb
BLAKE2b-256 c6370a6d5709b45776f5dc4c443a05ef756fac4e31e4111fbf069eab251ba7f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wagtailimagecaptions-0.2.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 881d5089e1780f51cd83b6b51aab94049c0b572901e933c5de0575a41538c106
MD5 d6403b9e931e265a603fa93952361282
BLAKE2b-256 2f92f8fb95897a26d41720998fc092e8a970c22c2f23aaa5a0c819362d527a4d

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