This is a pre-release. djust 0.3.0 has shipped since: read the djust 0.3.0 release notes.
Before you upgrade, read Removed below.
Added
- All 57 Django template filters — The Rust template engine now supports the complete set of Django built-in filters. Added 24 filters across two batches:
default_if_none,wordcount,wordwrap,striptags,addslashes,ljust,rjust,center,make_list,json_script,force_escape,escapejs,linenumbers,get_digit,iriencode,urlize,urlizetrunc,truncatechars_html,truncatewords_html,safeseq,escapeseq,unordered_list,phone2numeric,pprint. (#246, #254) Seedocs/website/guides/template-cheatsheet.md. - Authentication & Authorization — Opinionated, framework-enforced auth for LiveViews. View-level
login_requiredandpermission_requiredclass attributes (plusLoginRequiredMixin/PermissionRequiredMixinfor Django-familiar patterns). Custom auth logic viacheck_permissions()hook. Handler-level@permission_required()decorator for protecting individual event handlers. Auth checks run server-side beforemount()and before handler dispatch — no client-side bypass possible. Integrates withdjust_auditcommand (shows auth posture per view) and Django system checks (djust.S005warns on unprotected views with exposed state). - Navigation & URL State —
live_patch()updates URL query params without remount,live_redirect()navigates to a different view over the same WebSocket. Includeshandle_params()callback,live_session()URL routing helper, and client-sidedj-patch/dj-navigatedirectives with popstate handling. (#236) - Presence Tracking — Real-time user presence with
PresenceMixinandPresenceManager. Pluggable backends (in-memory and Redis). IncludesLiveCursorMixinandCursorTrackerfor collaborative live cursor features. (#236) Seedocs/website/guides/presence.md. - Streaming —
StreamingMixinfor real-time partial DOM updates (e.g., LLM token-by-token streaming). Providesstream_to(),stream_insert(),stream_text(),stream_error(),stream_start()/stream_done(), andpush_state(). Batched at ~60fps to prevent flooding. (#236) Seedocs/website/guides/streaming-markdown.md. - File Uploads —
UploadMixinwith binary WebSocket frame protocol for chunked file uploads. Includes progress tracking, magic bytes validation, file size/extension/MIME checking, and client-sidedj-upload/dj-upload-dropdirectives. (#236) Seedocs/website/guides/uploads.md. - JS Hooks —
dj-hookattribute for client-side JavaScript lifecycle hooks (mounted, updated, destroyed, disconnected, reconnected). (#236) - Model Binding —
dj-modeltwo-way data binding with.lazyand.debounce-Nmodifiers. Server-sideModelBindingMixinwith security field blocklist and type coercion. (#236) Seedocs/website/guides/model-binding.md. - Client Directives —
dj-confirmconfirmation dialogs,dj-targetscoped updates, embedded view routing in event handlers. (#236) - Server-Push API — Background tasks (Celery, management commands, cron jobs) can now push state updates to connected LiveView clients via
push_to_view(). Includes per-view channel groups (auto-joined on mount), a sync/async public API (push_to_view/apush_to_view), and periodichandle_tick()for self-updating views. (#230) - Progressive Web App (PWA) Support — Complete offline-first PWA implementation with service worker integration, IndexedDB/LocalStorage abstraction, optimistic UI updates, and offline-aware template directives. Includes comprehensive template tags (
{% djust_pwa_head %},{% djust_pwa_manifest %}), PWA mixins (PWAMixin,OfflineMixin,SyncMixin), and automatic synchronization when online. (#235) Seedocs/website/guides/pwa.md. - Multi-Tenant SaaS Support — Production-ready multi-tenant architecture with flexible tenant resolution strategies (subdomain, path, header, session, custom, chained), automatic data isolation, tenant-aware state backends, and comprehensive template context injection. Includes
TenantMixinandTenantScopedMixinfor views. (#235) dj-pollattribute — Declarative polling for LiveView elements. Adddj-poll="handler_name"to any element to trigger the handler at regular intervals. Configurable viadj-poll-interval(default: 5000ms). Automatically pauses when the page is hidden and resumes on visibility change. (#269)DjustMiddlewareStack— New ASGI middleware for apps that don't usedjango.contrib.auth. Wraps WebSocket routes with session middleware only (no auth required). UpdatedC005system check to recognize bothAuthMiddlewareStackandDjustMiddlewareStack. (#265)- System check
C006— Warns whendaphneis inINSTALLED_APPSbutwhitenoisemiddleware is missing. (#259) startproject/startapp/newCLI commands —python -m djust new myappcreates a full project with optional features (--with-auth,--with-db,--with-presence,--with-streaming,--from-schema). Legacystartprojectandstartappcommands also available. (#266)djust mcp installCLI command — Automates MCP server setup for Claude Code, Cursor, and Windsurf. Triesclaude mcp addfirst (canonical for Claude Code), falls back to writing.mcp.jsondirectly. Merges with existing config, backs up malformed files, idempotent. Seedocs/website/guides/mcp-server.md.- Simplified root element —
dj-viewis now the only required attribute on LiveView container elements. The client auto-stampsdj-rootanddj-liveview-rootat init time. Old three-attribute format still works. (#258) - Model
.pkin templates —{{ model.pk }}now works in Rust-rendered templates. Model serialization includes apkkey with the native primary key value. (#262) Seedocs/website/guides/template-cheatsheet.md. - Better Error Messages — Improved error messages for common LiveView event handler mistakes (missing
@event_handler, wrong method signature). (#248) Seedocs/website/guides/flash-messages.md. LiveViewSmokeTestmixin — Automated smoke and fuzz testing for LiveView classes. (#251)- MCP server —
python manage.py djust_mcpstarts a Model Context Protocol server for AI assistant integration. Provides framework introspection, system checks, scaffolding, and validation tools. Used bydjust mcp installto configure Claude Code, Cursor, and Windsurf. Seedocs/website/guides/mcp-server.md. djust_auditmanagement command — Security audit showing auth posture, exposed state, and handler signatures per view.djust_checkmanagement command — Django system checks for project validation. Gains--fixflag for safe auto-fixes and--format jsonfor enhanced output with fix hints.djust_schemamanagement command — Extract and generate Django models from JSON schema files. Seedocs/guides/djust-audit.md.djust_ai_contextmanagement command — Generate AI-focused context files for LLM integrations. Seedocs/guides/djust-audit.md.- AI documentation —
docs/ai/with focused guides for events, forms, JIT, lifecycle, security, and templates.docs/llms.txtanddocs/llms-full.txtfor LLM context. - Auto-build client.js from src/ modules — Pre-commit hook runs
build-client.shwhensrc/files change. (#211) - Keyed-mutation fuzz test generator — New proptest generator produces tree B by mutating tree A, exercising keyed diff paths more effectively. Proptest cases bumped from 500 to 1000. (#216, #217)
Changed
- BREAKING:
data-dj-*prefix stripping — Client-sideextractTypedParams()now strips thedj_prefix fromdata-dj-*attributes.data-dj-preset="dark"sends{preset: "dark"}instead of{dj_preset: "dark"}. Update handler parameter names accordingly:dj_foo→foo. - State Backends — Enhanced with tenant-aware isolation support (
TenantAwareRedisBackend,TenantAwareMemoryBackend).
Performance
- Batched
sync_to_asynccalls — Event handler processing now uses 2 thread hops instead of 4, saving ~1-4ms per event. (#277) - Eliminated JSON encode/decode roundtrip — Direct
normalize_django_value()Python-to-Python type normalization replaces 17json.loads(json.dumps(...))patterns. Saves 2-5ms per event for views with database objects. (#279) - Cached template variable extraction — Rust
extract_template_variables()results cached by content hash (SHA-256). Size-capped at 256 entries with automatic eviction. (#280) - Cached context processor resolution —
resolve_context_processors()results cached per settings configuration. Invalidated onsetting_changedsignal. (#281) - JIT short-circuit for non-DB views — Views without QuerySets or Models in context skip the entire JIT serialization pipeline. Saves ~0.5ms per event for simple views. (#278)
- Slimmer debug payload — Event responses send only state variables; handler metadata moved to initial mount as static data. ~68% smaller debug payloads (~25KB → ~8KB per event).
Fixed
- Inline args on form events —
dj-change,dj-input,dj-blur,dj-focusnow parse inline arguments (e.g.,dj-change="toggle(3)") before sending to server. Also fixed state change detection to use deep copy comparison, catching in-place mutations. - Error overlay on intentional disconnect — Suppress "WebSocket Connection Failed" overlay during TurboNav navigation via
_intentionalDisconnectflag. - VDOM patch failure recovery — When VDOM patches fail, the client requests recovery HTML on demand instead of reloading the page. Uses DOM morphing to preserve event listeners and form state. (#259)
- HTTP Fallback Protocol —
post()now accepts the HTTP fallback format where the event name is in theX-Djust-Eventheader and params are flat in the body JSON. (#255) - Debug panel HTTP-only mode — POST responses include
_debugpayload whenDEBUG=True, enabling the debug panel in HTTP-only mode. (#267) - Silent LiveView config failures — Client JS now shows helpful
console.errorwhen no LiveView containers are found. Added system checkV005for modules not inLIVEVIEW_ALLOWED_MODULES. (#257) - HTTP-only mode session state on GET —
get()now saves view state to the session immediately whenuse_websocket: False. (#264) use_websocket: Falseclient-side enforcement — Setting now actually prevents WebSocket connections. (#260)- DOM morphing preserves event listeners —
html_updatenow uses morphdom-style DOM diffing instead ofinnerHTML. (#236) - Textarea newlines preserved — Template whitespace stripping no longer collapses newlines inside
<textarea>elements. (#236) - PresenceMixin crash without auth —
track_presence()now checks forrequest.userbefore accessing it. (#236) _skip_rendersupport in server_push —server_push()now checks_skip_render, preventing phantom renders and VDOM version mismatches. (#236)- Client-side SetText mis-targets after keyed MoveChild — MoveChild patches now include
child_dfordata-dj-idresolution. (#225) - VDOM diff/patch round-trip on keyed child reorder — Patches now processed level-by-level (shallowest parent first). (#212)
- apply_patches djust_id-based resolution — Resolves parent nodes by
djust_idinstead of path-based traversal. (#216) - Diff engine keyed+unkeyed interleaving — Emits
MoveChildpatches for unkeyed element children in keyed contexts. (#219) - Text node targeting after keyed moves —
SetTextpatches carrydjust_idwhen available;sync_idspropagates IDs to text nodes. (#221) - Tag registry test pollution —
clear_tag_handlers()now restores built-in handlers in teardown. (#261)
Security
- HTTP POST handler dispatch gating —
post()now enforces the same security model as the WebSocket path: only@event_handler-decorated methods can be invoked. Validates event names withis_safe_event_name()to block dunders and private methods. - Auto-escaping in Rust template engine —
SafeStringvalues propagated to Rust for proper auto-escaping. - HTML-escaped
urlizeandunordered_listfilters — Both filters now escape their output to prevent XSS. (#254) - Template tag XSS prevention — All PWA template tags now use
format_html()andescape()instead ofmark_safe()with f-string interpolation. - Sync endpoint hardening — Removed
@csrf_exemptfromsync_endpoint_view. Added authentication requirement, payload validation, and safe field extraction. - Silent exception elimination — All
except: passpatterns replaced with appropriate logging calls. - Production JS hardened — All
console.logcalls guarded behinddjustDebugflag.
Removed
_allowed_eventsclass attribute — The backwards-compatibility escape hatch that allowed undecorated methods to be called via WebSocket or HTTP POST has been removed. All event handlers must now use the@event_handlerdecorator.