Skip to main content

django-wagtail-ai-generation

Portable Django library: floating AI assistant on Wagtail page edit — copy/paste prompts with a live JSON schema from your StreamFields, or optional in-app LLM when you install a companion app (e.g. llms).

Author: Aymane Nahji

Zero configuration

After adding the app to INSTALLED_APPS, you do not set a page model or StreamField name in Django settings.

  • The assistant uses the page you are editing (concrete Page subclass).
  • It discovers every StreamField on that model.
  • One field: used automatically. Several: bubble picker + per-field schema/apply.
  • Prompt content rules and minimal shape examples follow the schema on that page (plain RichTextBlock → rich_text string, not text_en/text_fr/text_ar unless your blocks are localized).

No WAGTAIL_AI_GENERATION_PAGE_MODEL or WAGTAIL_AI_GENERATION_BODY_FIELD is required — see in-app README for optional limits.

Requirements

  • Python 3.11+
  • Django 5+, Wagtail 6+
  • Pillow (image import from URLs in AI JSON)

Optional: django-wagtail-icon-chooser so IconChooserBlock fields appear as lucide_icon in the schema.

Install

pip install django-wagtail-ai-generation
# or from a checkout:
pip install /path/to/django-wagtail-ai-generation
INSTALLED_APPS = [
    # ...
    "wagtail",
    "wagtail_ai_generation",
]

Expose StreamFields with FieldPanel (or panels Wagtail renders in the editor). The bubble appears when the user can edit the page and the model has at least one StreamField.

Features

  • Per-block AI edit / AI replace on each stream in the editor.
  • External workflow: copy prompt → any LLM → paste JSON to apply.
  • Schema bundle: block types, field types (str, rich_text, localized, image, …), minimal examples.
  • Optional in-app agent when WAGTAIL_AI_GENERATION_LLMS_APP points at an installed connections app.

API (Wagtail admin, staff + CSRF)

Method Path Purpose
GET …/ai-generation/context/?page_id=&stream_field= Context + schema for one StreamField
POST …/ai-generation/ Apply pasted AI JSON (stream_field_name in body)
POST …/ai-generation/run/ LLM generate + apply (when LLM app enabled)

stream_field / stream_field_name is the model attribute name of the StreamField (discovered server-side).

Preferred AI output

{
  "analysis": { "action": "append", "target_index": null, "summary": "..." },
  "blocks": [{ "type": "title_description", "value": { "title": "Hello", "description": "<p>…</p>" } }]
}

Develop & test

pip install -e ".[dev]"
PYTHONPATH=. DJANGO_SETTINGS_MODULE=tests_project.settings python -m django test wagtail_ai_generation

More detail

Integration, optional settings, schema types, i18n, security: wagtail_ai_generation/README.md.

License

MIT — see LICENSE.

Metadata

Release files for django-wagtail-ai-generation 0.1.0

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

Source distribution (sdist)

Source distribution for django-wagtail-ai-generation 0.1.0
File Size Uploaded Provenance Actions
django_wagtail_ai_generation-0.1.0.tar.gz 103.1 kB Without provenance Details for django_wagtail_ai_generation-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-wagtail-ai-generation 0.1.0
File Interpreter ABI Platform Actions
django_wagtail_ai_generation-0.1.0-py3-none-any.whl Python 3 none any Details for django_wagtail_ai_generation-0.1.0-py3-none-any.whl

Total release size: 170.7 kB

Release files / django_wagtail_ai_generation-0.1.0.tar.gz

Download URL django_wagtail_ai_generation-0.1.0.tar.gz
Size 103.1 kB
Tags Source
SHA-256 checksum
How to use checksums
892edf070e6cd2e26b0c5d2aac8ff514c4e30fd29694bbe0be1fa11b9c04c26d
BLAKE2b-256 checksum
How to use checksums
70892d90140a181f9ef81e4c965b4f64b8297b0b7118060d3a7e37a2ef8f3d88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / django_wagtail_ai_generation-0.1.0-py3-none-any.whl

Download URL django_wagtail_ai_generation-0.1.0-py3-none-any.whl
Size 67.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
283b10d1f610d7dc458fa9838541bf6f5be2150e9fb8b72bd901fee5548e8640
BLAKE2b-256 checksum
How to use checksums
9b220ebe4285ceaaaeef70288f3c82dc6a05e34903a4b9aa9261ca3b6ab609d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for django-wagtail-ai-generation 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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