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.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for wagtailimagecaptions-0.2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22a2b0b8df83ad5929187ed067f1badb1cab3998d487f45ad7451ed12d0ebd68 |
|
MD5 | e2c67adee26ef1c05d4ee850dec1ec81 |
|
BLAKE2b-256 | 149cfa4f2ef72a4a36263f3b1e4a708d71493ebb55edfe226017e5707c9acb4f |
Hashes for wagtailimagecaptions-0.2.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6e9bef461c83446e613168b0237455e6a84be703371249eda81708517ff074f |
|
MD5 | 0d64aa6869ce102ffbc841bd4396c70b |
|
BLAKE2b-256 | 45b415b1c14bee3682f23ec37e6802d3d2850d9bdc64ebde05b768faefce8d97 |