Skip to main content

django-spec-html

CI PyPI Python versions Django versions Docs Coverage Ruff License

A django-service-specs spec served over plain Django, with no API framework between the request and the kernel's dispatch. SpecFormView serves a spec whose Validator is a Django form as the page a person fills that form in on, and a refused post comes back as the page again with the refusal placed on its form. The page reads no htmx header: an htmx post is answered as any other, so a success is a redirect the request follows and a refusal is the whole page at a 4xx status, which htmx does not swap by default. A fragment answer for htmx is planned for 0.2.0. Beside the pages, SpecView, AsyncSpecView and dispatch_request serve a spec as JSON, for a script or a fetch().

Both halves are the kernel's, moved out with their history so the kernel carries no transport: the JSON views as kernel 0.11.0 shipped them, and SpecFormView as kernel 0.5.1 did. The behaviour is the kernel's, but for the page answering an UnsupportedMediaType an operation raises at 415 where the kernel's answered 400; the import path is this package's. The kernel no longer ships these names: import them from django_spec_html.

Install

pip install django-spec-html

Python 3.10 or later, Django 4.2 or later, and django-service-specs 0.12.0 or later, which it installs. Neither package needs an entry in INSTALLED_APPS.

Quickstart

A page, for a spec whose Validator is a FormValidator. GET renders the form; a valid POST dispatches and redirects; a refused one renders the form again with the refusal on it:

# yourapp/urls.py
from django.urls import path, reverse_lazy
from django_spec_html import SpecFormView

from yourapp.specs import add_book_spec  # a ServiceSpec with a FormValidator

urlpatterns = [
    path(
        "books/add/",
        SpecFormView.as_view(
            spec=add_book_spec,
            template_name="books/add.html",  # renders {{ form }} in a POST form
            success_url=reverse_lazy("books"),
        ),
    ),
]

A JSON view, for any spec. The view reads the arguments from the query string or the body and the route, dispatches, and answers the presented result, or the refusal at its status:

from django.urls import path
from django_spec_html import SpecView

from yourapp.specs import list_notes_spec, rename_note_spec

urlpatterns = [
    path("notes/", SpecView.as_view(spec=list_notes_spec)),
    path("notes/<int:pk>/rename/", SpecView.as_view(spec=rename_note_spec)),
]

Documentation

https://artui.github.io/django-spec-html/

License

MIT. See LICENSE.

Metadata

Release files for django-spec-html 0.1.2

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-spec-html 0.1.2
File Size Uploaded Provenance
django_spec_html-0.1.2.tar.gz 199.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-spec-html 0.1.2
File Interpreter ABI Platform
django_spec_html-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 238.6 kB

Release files / django_spec_html-0.1.2.tar.gz

Download URL django_spec_html-0.1.2.tar.gz
Size 199.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d54f2b80e68af2a156245df1498b73ea6b8fd902e76af574a965e1aaa173ffef
BLAKE2b-256 checksum
How to use checksums
6c2d2906a455f7cc040f413aef5d50f7abd9a83998576a0c6b8f0e91ae2ce85e
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 Oct 21, 2026.

Transparency log

Release files / django_spec_html-0.1.2-py3-none-any.whl

Download URL django_spec_html-0.1.2-py3-none-any.whl
Size 38.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c00c0ae3e0279d525f0e0148f1087a23ccb8c6f748c15e02e80af993574a79ff
BLAKE2b-256 checksum
How to use checksums
12b70aeeecbff16424be79b86f91b22ba76b880c6698e4f01b3fc4eeb35ee86c
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 Oct 21, 2026.

Transparency log

Security for django-spec-html 0.1.2

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_spec_html-0.1.2.tar.gz

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 Oct 21, 2026.

Transparency log

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.

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