Skip to main content

hue-django

Django integration for hue: class-based views that render hue pages and Alpine AJAX fragments, a router that understands Django path syntax, and middleware that serves hue's CSS and JS straight from the package.

Install

uv add hue-django
# settings.py
MIDDLEWARE = [
    "hue_django.middleware.HueAssetsMiddleware",  # serves /__hue__/styles.css and js
    ...
]

Usage

from django.http import HttpRequest
from hue import html
from hue.context import HueContext
from hue_django.pages import Page
from hue_django.router import Router
from hue_django.views import HueView


class LoginView(HueView):
    router = Router[HttpRequest]()

    async def index(self, request: HttpRequest, context: HueContext[HttpRequest]) -> Page:
        return Page(title="Login", body=html.div("Login page"))

    @router.fragment_post("login/")
    async def login(self, request: HttpRequest, context: HueContext[HttpRequest]):
        return html.div("Login successful")


# urls.py
urlpatterns = [path("login/", include(LoginView.urls))]

Fragment routes are AJAX-only and return HTML fragments; index serves the full page. Handlers may be sync or async, may return a Django response (a redirect, say) to pass it through, and may declare a typed body parameter to have the request body parsed and validated with Pydantic. Validation failures return 422 via the overridable handle_body_validation_error hook.

HueFragmentsView is the same without an index, for grouping related fragments. The Alpine bundle sends the CSRF token as X-CSRFToken on AJAX requests; use hue_django.ui.CsrfTokenInput in forms that post without AJAX.

Settings: HUE_EXTRA_CSS_URLS (extra stylesheets after hue's) and HUE_HTML_TITLE_FACTORY (callable formatting the document title).

Metadata

Release files for hue-django 0.0.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 hue-django 0.0.1
File Size Uploaded Provenance Actions
hue_django-0.0.1.tar.gz 56.5 kB Without provenance Details for hue_django-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hue-django 0.0.1
File Interpreter ABI Platform Actions
hue_django-0.0.1-py3-none-any.whl Python 3 none any Details for hue_django-0.0.1-py3-none-any.whl

Total release size: 69.6 kB

Release files / hue_django-0.0.1.tar.gz

Download URL hue_django-0.0.1.tar.gz
Size 56.5 kB
Tags Source
SHA-256 checksum
How to use checksums
aa5ad26b586d48c7d6efefad8e1ead64f27ecbb417e4b09227609926f1c6a2c6
BLAKE2b-256 checksum
How to use checksums
61b9fd0fff6926de72a639e907cd196172d7f1f74a88c4e53a1cbf6a1ea899ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / hue_django-0.0.1-py3-none-any.whl

Download URL hue_django-0.0.1-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c96ec20c3cbf21b16d5b7a6cc21a1005fed30f892629b6c343a5b3b039abafca
BLAKE2b-256 checksum
How to use checksums
d457d570a507ece3a8da44acd377e13c74ae5d077a7fe7f1c495c9e295403fc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for hue-django 0.0.1

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.0.1 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