Skip to main content

platzky-promocode

A platzky plugin that adds a click-to-reveal promo code button.

The reveal is a native <details> disclosure, so the plugin ships no JavaScript: it works under a strict CSP and is keyboard- and screen-reader-accessible without any script.

Installation

pip install platzky_promocode

Configuration

Plugins are configured in platzky's database, under a top-level plugins object keyed by plugin name (for the JSON database that is inside DB.DATA; the GraphQL and MongoDB backends store the same structure):

{
    "plugins": {
        "promocode": {
            "is_active": true,
            "allowed_content_types": ["post", "page"],
            "config": {
                "text": "Reveal your discount",
                "color": "#e63946"
            }
        }
    }
}

The key (promocode) must match the plugin's entry-point name.

Field Required Default Description
is_active yes false The plugin is skipped entirely unless this is true
allowed_content_types yes [] Content types the plugin may transform. Platzky provides post, page and comment; a host application adds its own. Empty means the plugin loads but transforms nothing
config no {} Plugin settings, see below

allowed_content_types is enforced by the engine and intersected with the content types the plugin accepts, so it can only narrow them, never widen them. This plugin accepts every content type the application knows — a promo code is inert markup, so there is nowhere it is unsuited to — which means the grant alone decides where it runs, and naming a type here is the only thing that switches it on.

Name the types your application actually has. A grant naming an unknown type silently does nothing, and platzky says so at startup:

Plugin PromocodePlugin is granted content type 'field', which this application does not
produce; the grant has no effect. Known types: comment, page, post

Plugin settings (config)

Field Required Default Description
text no "Reveal Promo Code" Button label before reveal — a plain string, or a {locale: label} map for per-language labels
color no "#4caf50" Button background (any CSS color literal)

Translated button labels

text can be a map of locale codes to labels instead of a single string. The label matching the visitor's active locale is used, falling back to the first entry in the map when there is no match:

{
    "plugins": {
        "promocode": {
            "is_active": true,
            "allowed_content_types": ["post", "page"],
            "config": {
                "text": {
                    "en": "Reveal Promo Code",
                    "pl": "Pokaż kod promocyjny",
                    "uk": "Показати промокод"
                }
            }
        }
    }
}

Usage in blog content

Embed the promo code directly in post content using the shortcode:

Get 20% off with code [promocode]SUMMER24[/promocode] — don't miss out!

An optional color attribute overrides the configured button colour:

Grab your [promocode color="#e91e63"]SAVE20[/promocode] before it expires!

Usage in a host application's content field

A platzky host application can render the same button from one of its own content fields, with no per-plugin frontend code. Name the field after the shortcode (promocode) — that is how the host knows to route it here — and give it the code itself, or a dict with per-entry overrides:

{
    "promocode": { "code": "HABZASPOT", "color": "green" }
}

allowed_content_types must include whichever content type the host uses for such fields (see the config above). Nothing else is needed: the shortcode renders the field itself and the host displays that rendering — there is no bundle to serve and nothing to register on the frontend.

Add head to allowed_page_sections as well, so the plugin's stylesheet is injected:

plugins:
  promocode:
    is_active: true
    allowed_content_types: ["post", "page"]  # plus the host's own field type, if any
    allowed_page_sections: ["head"]

Release files for platzky-promocode 0.5.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 platzky-promocode 0.5.1
File Size Uploaded
platzky_promocode-0.5.1.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for platzky-promocode 0.5.1
File Interpreter ABI Platform
platzky_promocode-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 18.8 kB

Release files / platzky_promocode-0.5.1.tar.gz

Download URL platzky_promocode-0.5.1.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d53c51db35b3989329fa1ce471e161c2d0ef7528890469d2de12c3449ea76890
BLAKE2b-256 checksum
How to use checksums
a3721444542859121f4b352b47550ef3842e0ec150d1297169defba8200893b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / platzky_promocode-0.5.1-py3-none-any.whl

Download URL platzky_promocode-0.5.1-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36691781e98a21521d1a5a093c6be3478c9e0d4bd7e0625ca6d11f829b7ed6c6
BLAKE2b-256 checksum
How to use checksums
6a47ab56c592ea760d3dc5088ff82240a6010cb504bc6100369f5052c3245ec8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.2

2 release files

This release

0.5.1 This release

2 release files

0.4.0

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

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