Skip to main content

Wagtail package to render images with rendition in a single API Field.

Project description

Wagtail SB ImageSerializer

Wagtail package to render images with rendition in a single API Field.

Community-Project

PyPI - Supported versions PyPI - Package version PyPI - Downloads PyPI - License Codacy Grade Badge Codacy Coverage Badge Gitlab Pipeline Status

Wagtail package to render images with rendition in a single API Field.

✨ Features

  • Standardized Serialization: Built for simple integration with Wagtail headless setups or general DRF endpoints.
  • Easy Configuration: Quickly define social media image renditions.
  • Modern Stack: Built for modern Python (3.11+) and up to date Django/Wagtail versions.

📋 Requirements

  • Python 3.11 or higher
  • Wagtail 5.2 or higher
  • Django 4.2 or higher

📦 Installation

Using pip

pip install wagtail-sb-imageserializer

Using uv

uv add wagtail-sb-imageserializer

🚀 Usage

Add wagtail.api.v2, rest_framework and wagtail_sb_imageserializer to your INSTALLED_APPS settings:

INSTALLED_APPS = [
  # ...
  "wagtail.api.v2",
  "rest_framework",
  "wagtail_sb_imageserializer",
  # ...
]

In your model specify the ImageSerializerField as serializer for the APIField related to the image field and add the renditions parameter with the renditions you want to render.

from wagtail.models import Page
from wagtail.api import APIField
from wagtail_sb_imageserializer.fields import ImageSerializerField

class SamplePage(Page):
    image = ImageSerializerField()

    api_fields = [
        APIField(
          "image",
          serializer=ImageSerializerField(
              renditions={
                  "lazy": "fill-50x50",
                  "mobile": "fill-128x128",
                  "tablet": "fill-256x256",
                  "desktop": "fill-512x512",
              }
          ),
        ),
    ]

🛠️ Development

Check out our Contribution Guide for details on setting up your development environment, running tests, and submitting pull requests.

The project uses uv for dependency management, ruff for linting, and tox for multi-environment testing.

📜 Changelog

See the CHANGELOG.md for a history of changes.

👥 Contributors

See our list of contributors.

📄 License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

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

wagtail_sb_imageserializer-0.6.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wagtail_sb_imageserializer-0.6.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file wagtail_sb_imageserializer-0.6.0.tar.gz.

File metadata

  • Download URL: wagtail_sb_imageserializer-0.6.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for wagtail_sb_imageserializer-0.6.0.tar.gz
Algorithm Hash digest
SHA256 9528b04862a59e0cbbe82f08d5513bbe8b23801bddd5b787b78f7870e11c0003
MD5 74e49684f9ddb18e8f1a4501e2a07be9
BLAKE2b-256 b45c785d559e40ca60fb6b7fd9a1f81079af81a53b0a7a0c83b68ea1882cceb4

See more details on using hashes here.

File details

Details for the file wagtail_sb_imageserializer-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: wagtail_sb_imageserializer-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for wagtail_sb_imageserializer-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7aaebc17d648046780ba2f2f842bb5c77c7d7ea7214a342224be10b9e2eb8f78
MD5 953cedde54bc8ddd77e96e1ec5877687
BLAKE2b-256 57795c39d3dfd5146cd3da63487b8490696552f5d85e6c7be5c156a4449af2c8

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