Skip to main content

PyPI version

wagtial placeholder images

This is a package for using placeholder images when developing which can be useful if you're storing them on a server and don't want to download them or link directly to the server when working locally.

Installation

First download the package:

pip install wagtail-placeholder-images

Then there's two options. If you're using your own custom image model you can use PlaceholderRenditionMixin like so:

from wagtail.images.models import AbstractImage
from wagtail_placeholder_images.mixins import PlaceholderRenditionMixin


class CustomImage(PlaceholderRenditionMixin, AbstractImage):
    admin_form_fields = Image.admin_form_fields + (
        # Then add the field names here to make them appear in the form:
        # 'caption',
    )

If you're using the standard Wagtail Image model you can monkey patch it:

from wagtail.images.models import AbstractImage
from wagtail_placeholder_images.mixins import PlaceholderRenditionMixin


AbstractImage.get_placeholder_rendition = PlaceholderRenditionMixin.get_placeholder_rendition
AbstractImage.get_rendition = PlaceholderRenditionMixin.get_rendition

Then you have to set WAGTAIL_PLACEHOLDERIMAGES_DUMMY to True and use your desired placeholder source by setting WAGTAIL_PLACEHOLDERIMAGES_SOURCE. This should be done in your development settings file, so this doesn't get enabled on your servers. E.g.

# settings_dev.py

WAGTAIL_PLACEHOLDERIMAGES_DUMMY = True
WAGTAIL_PLACEHOLDERIMAGES_SOURCE = "//placedog.net/{width}/{height}/"

That should be it!

Release files for wagtail-placeholder-images 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wagtail-placeholder-images 0.1.1
File Size Uploaded
wagtail-placeholder-images-0.1.1.tar.gz 3.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wagtail-placeholder-images 0.1.1
File Interpreter ABI Platform
wagtail_placeholder_images-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.1 kB

Release files / wagtail-placeholder-images-0.1.1.tar.gz

Download URL wagtail-placeholder-images-0.1.1.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4f9070ce3ffaa2be02e0baf6c6b44c9f8d6d9302a60e384f85310c5e6b432bae
BLAKE2b-256 checksum
How to use checksums
e3258cd14265f3b82fe4ab4ba1f7dcea25b83b82a81055f600aaf0ef82bf3b7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / wagtail_placeholder_images-0.1.1-py3-none-any.whl

Download URL wagtail_placeholder_images-0.1.1-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44cbdb18e4123c8423758c21f9e25c399c3a1f8349791071786d62e1c6077c0f
BLAKE2b-256 checksum
How to use checksums
c12484b73cf258baef5ce6251409516086778cdcb3c7dd4d69d34d39ea6f2e29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page