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.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 hue-django 0.0.2
File Size Uploaded Provenance Actions
hue_django-0.0.2.tar.gz 56.8 kB Without provenance Details for hue_django-0.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 69.8 kB

Release files / hue_django-0.0.2.tar.gz

Download URL hue_django-0.0.2.tar.gz
Size 56.8 kB
Tags Source
SHA-256 checksum
How to use checksums
42d6a7e16aec1a8c2192ad84ee23e1346b6eb8b0d61f6d2844ee0c02415af541
BLAKE2b-256 checksum
How to use checksums
05352512a8405c14926ed06c7b5046fde919469577f63e35226128ccdc748c96
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.2-py3-none-any.whl

Download URL hue_django-0.0.2-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce1998ecd10fd6e346066fb6634be1e3992402dc790f6f3cf3b9058c9fcb2a83
BLAKE2b-256 checksum
How to use checksums
364fe3109fb97a74fbb77a10bc9694c101e78345155aae120c71a322227739f6
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.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.

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