Before you upgrade, read Removed, Deprecated below.
Upgrading from rc5. The legacy modes are gone:
exposure_policy = "legacy"andparameter_policy="legacy"now raiseImproperlyConfigurednaming the replacement (#4199), and the legacy code paths, checks and 1.x shims behind them are deleted (#4200-#4207); rundjust_exposure_inventory --fixon any view not yet migrated.djust.reactis removed (#4006). The wire protocol moves to onerenderframe per turn witheffects[](#3658): a browser still holding an rc5 client reloads once. State saves are deferred by default (DJUST_STATE_SAVE_INTERVAL= 2 s, #4164), the client loads as a core bundle plus chunks (#4007), and severaldjust.components.uicomponents and component tags now draw one shared markup on both engines, so their HTML changes (#4002, #4331). Security:dj-modelaccepts only bindings that rendered for the current state (new checkdjust.T030lists fields that needallowed_model_fields), component and embedded-child events run the page's object-permission check, and anonymous presence ids no longer expose the session key. See the 2.0 migration guide.
Added
A turn benchmark over all three transports (#3657).
make benchmark-transports(scripts/bench_turn_transports.py) times complete event turns through the real stack over WebSocket, SSE and the HTTP fallback, for five workloads (form, 1,000-row table, dashboard, server push, editor), with and without the session save, at simulated round-trip times of 0, 20, 100 and 250 ms. It reports p50/p95 latency, CPU per turn, event-loop lag, wire bytes and retained memory per page, writes JSON, and--compareprints ratios against a saved run. The baseline and method are indocs/performance/turn-transports-baseline.md; the measured run is committed asdocs/performance/turn-transports-baseline.jsonfor later performance work to compare against.A wire-protocol version, and a self-reload for outdated tabs (#3658). The server and the client bundle name a protocol version (
2). The client sends it with every mount verb, on the SSE stream GET and in theX-Djust-Protocolheader of its POSTs. A tab running an older cached bundle (1.x, or a 2.0 release candidate) is told to reload: WebSocket close code 4409 after areloadframe, an SSEreloadframe, or HTTP 409protocol_mismatch. The bundle URLs carry?v=<djust version>so the reload fetches the new bundle. A third refusal of the same session within 30 seconds sends noreloadframe, so a service worker that keeps serving the old page shell cannot make the tab reload forever; unregister it or clear the site's data. Clients that send no version (scripts, hand-built test frames) can be accepted withDJUST_ALLOW_MISSING_PROTOCOL = True.Outbound limits for slow clients (#3658). Each WebSocket now holds the frames that wait while the client reads slowly in a buffer bounded in bytes,
LIVEVIEW_CONFIG["max_outbound_buffer_bytes"](default 4 MiB,0= no limit). Over the bound the socket is closed with code 1013 and the client reconnects and remounts through the ordinary recovery path; frames keep their order, one frame is always sent whatever its size, and aclose()sends the frames queued before it first. An SSE session's queue has the same byte bound: past it the backlog is dropped and the stream ends, soEventSourcereconnects and the reconnect mount resyncs the page. The limits per transport are in the reconnection guide.djust_audit --a11y --url: a rendered-page accessibility pass with axe-core (#3700). TheYrules scan template text, so they cannot check contrast (WCAG 1.4.3, 1.4.11), landmarks, heading order or names that exist only after render.--a11y --url <url>(repeatable) loads each page in headless Chromium and runs axe-core over it; with--base-urland no--url, it audits a route of every view apermissions.yamldeclares. Normal mode stays warning-only;--strictexits 1 on a serious or critical violation, and a page that could not be audited exits 1.--jsonis supported. The browser tooling is the new optional extradjust[a11y](Playwright plusaxe-playwright-python, which shipsaxe.min.js); without it the command exits 2 and names the extra.--headervalues reach only the audited origin. 33 tests inpython/tests/test_audit_a11y_rendered_3700.py, plus a real-browser check intests/playwright/test_a11y_rendered_3700.py.allow_upload(timeout=seconds)(#4118). An upload still unfinished that many seconds after the browser registered it (or resumed it) is cancelled: its writer is aborted with aTimeoutError, its entry dropped, and the browser gets statuscancelledwith "Upload timed out after N seconds.", which rejects itsuploadFile()promise. DefaultNone: no limit.A reconnect that restores an older state than its page showed now says so (#4164). Reply and mount frames of a view whose state is saved carry
state_serial, the turn serial of the state they show; a reconnecting page sends it back. When storage is behind it, the reconnect first asks the tab's other connection, if it is still open, to save (through the channel layer, waiting up to one second), and if storage is still behind the page gets a transientstate_not_restorednotice ("Your most recent changes could not be restored."), shown in the save-status corner and dispatched asdjust:error. A page whose saves fail three times in a row is told once that its recent changes are not saved yet.An explicit {% live_render %} child takes events over the HTTP fallback (#4173). An explicit page's explicit child was refused on the page POST (
Embedded view not found). Its auto-assigned id is now named for the child on both exposure policies (and at any depth), so the GET and the POST agree; the POST re-mounts it under its own request and runs the socket runtime's event checks against that request (ownership, schema, reuse identity, state binding, view auth for an event, and the object permission again after the handler). A sticky child keeps itspersist="server"fields between POSTs. A child the page did not render, and a mixed-policy pair, are still refused withEmbedded view not found.An explicit dj-lazy view fills and takes events over the page-POST fallback (#4174).
<div dj-view="..." dj-lazy>on an explicit page was never registered over HTTP, so a browser with neither WebSocket norEventSourceleft it empty. A same-policy container is now registered and mounted with the checks of an eager explicit{% live_render %}child, under its lazy address. It keeps exactly itspersist="server"fields between POSTs; its other state starts again frommount(). A container whose exposure policy differs from the page's is still not registered.An upload in flight on an explicit view resumes after a WebSocket reconnect (#4175). The resume record is bound to the session, user, tenant and page and is checked on resume, on every upload frame and by
UploadStatusView; another session or user getsnot_found. Code usingResumableUploadWriterwithallow_upload(..., resumable=True)needs no change.sw_cacheable = Truelets an explicit page's HTML be cached by the service worker (#4176). Explicit pages are sentno-storeby default; a public page whose HTML is the same for every visitor opts in on the view class (every child view must opt in too), anddjust.V037reports an opted-in view that reads the user, the session or persisted state.LIVEVIEW_CONFIG["log_exception_detail"] = Truekeeps exception text and tracebacks in production server logs and firesgot_request_exception(Sentry) for explicit views on WebSocket, SSE and the HTTP fallback (#4180). Off by default; client frames and HTTP responses stay generic either way.sticky_update_inputs: an explicit sticky child keeps its state when updatable inputs change (#4181). An explicit sticky child's
{% live_render %}inputs were all part of its identity, so any change remounted it. Name the inputs that may change insticky_update_inputs; a change to one reuses the child and calls_on_sticky_update(changed), and its state (persist="server"fields too) survives. Any other input still remounts the child. This holds acrosslive_redirect: the carried child is updated and re-rendered after the mount frame. From 1.3:class Sidebar(LiveView): sticky = True sticky_id = "sidebar" sticky_update_inputs = ("section",) # new in 2.0 section = state("home") # was: self.section set in mount() def mount(self, request, section="home", **kwargs): self.section = section def _on_sticky_update(self, changed): if "section" in changed: self.section = changed["section"]start_async(fn, ..., survive_disconnect=True)and@background(survive_disconnect=True)let background work finish after the user disconnects (#4182). The task runs to completion when its view is disposed; its result is not rendered, and setting declared state, pushing or scheduling on the disposed view raisesViewDisposedError. Work without the opt-in is still cancelled.Upgrade checks for the legacy removal (#4190).
djust.V033(a legacy handler strict would refuse),djust.T028(a binding a legacy handler accepts that strict would refuse, in{% extends %}templates too),djust.V034(_target),djust.V035(_on_sticky_updateon an explicit view) anddjust.T029(data-*arguments in Python-built markup) report what a 1.3 project must change.manage.py djust_exposure_inventory --fixmakes the mechanical 2.0 upgrade changes (#4209). It deletesexposure_policy = "legacy", supplies the names each template reads fromget_context_data(), annotates unannotated handler parameters asAnyand renamesdata-*event arguments todj-value-*in templates whose handler declares them, then lists what needs a person (state()or context, real parameter types,_target,data-*built in Python).--dry-runprints the diff; it never writesstate()or apersist=grant.Opt-in
iddiff keys for HTML rendered withoutdj-ifmarkers (#4228).diff_html(old, new, id_keys=True)and the Rustdjust_vdom::key_by_idkey every element that has nodj-key/data-keyby itsid(as#<id>), so an unkeyed conditional that appears no longer rewrites the siblings after it and wipes their form input. Children ofdj-updateanddj-virtualcontainers are exempt. The default is unchanged:idis still not a diff key, and djust's own render path (which emitsdj-ifmarkers) does not use the opt-in. See "Opt-in:idas a fallback key" in the VDOM architecture guide.A tag library can vouch that it mounts no child view with
register.djust_childless = True(#4302). It has the same effect as listing the library inchildless_tag_libraries, without a project setting. New DEBUG checkdjust.C044warns when such a library registers aninclusion_tag, whose template the page-shell scan does not read.Upload hooks in the view (#4312). A view can define
handle_upload_started(name, entry),handle_upload_finished(name, entry)andhandle_upload_failed(name, entry, reason), and, on a slot withallow_upload(..., progress_hook=True),handle_upload_progress(name, entry)at the 10% steps the browser gets. Each runs as a turn of the view (in order on its lane, with a render and the usual end-of-turn drains); a hook that raises is logged and the upload goes on.reasonisrefused,too_large,timeout,cancelledorerror; a writer refusal's message isentry.error. A resume callshandle_upload_startedagain. A view without hooks pays nothing. On a socket with several views a hook is queued on its view's lane, so a slow hook never delays another view. The browser'supload_progressframes are now sent once per 10% step too (tiny chunks of a large file used to repeat a step on every chunk). WebSocket only, like uploads.More of the client loads on demand, and the first render preloads what it uses (#4320, #4007 slices 2-3). Ten more feature modules are client chunks the core bundle loads only on pages that use them:
component-behaviors(thedjust.componentswidgets),keyboard-nav,error-overlay(DjangoDEBUGonly; the deferred-save status stays core),dj-style(strict CSP styles),flip,transitions(dj-transition,dj-remove,dj-transition-group),infinite-scroll,prefetch,track-staticanddialog. The injected core drops from ~81 KB to ~68 KB gzipped; the SSE <!-- size-claim: historical --> transport stays in core (see the client-bundle guide). The LiveView now puts<link rel="preload" as="script">, with the CSP nonce, in the head for each chunk the first render uses, so a page that uses one costs no extra round trip before it binds, andgenerate_swprecaches the bundle actually injected and every chunk at the URLs the page requests instead of a hard-coded client.js URL.LIVEVIEW_CONFIG['client_bundle'] = 'full'still injects the single bundle. Tests intests/unit/test_client_chunks_4320.pyandtests/js/client-chunks-4007.test.js; the moved modules' suites join thesplit-buildvitest project.The JavaScript widget contract (#4322, after the hook lifecycle of #3656). "The widget contract" in
docs/website/guides/hooks.mddefines what a widget owns (adj-update="ignore"subtree,dj-ignore-attrs, a canvas's buffer), how props reach it and what it may write back, focus / selection / IME across updates, strict nonce CSP, and local drafts across patches, reconnects and navigation; it also settles the openupdated()scoping question (not scoped further, not paired withbeforeUpdate()). A hook'sthis.pushEvent(event, payload, {outcome: true})now resolves with{status, reply, error}, statusok/error/rejected(strict parameters) /rate_limited/cancelled/disconnected, matched byrefand settled after the reply is applied; without the option it still resolves with the reply ornull. The server echoes the event'srefon error frames sent during its turn (a handler that raised included, with or without DEBUG detail) and on turn rate-limit refusals, and codes a per-handler@rate_limitdroprate_limited. On an HTTP-only page a hook's event is now a page POST instead of being dropped. Also fixed on the way: an SSE reconnect morphs the page back (widgets keep their instances, as over WebSocket) instead of re-rendering it; the route-map script of{% djust_client_config %}carries the CSP nonce inside a LiveView's own template; a morph no longer re-runs a{% colocated_hook %}body (which failed under a nonce CSP); the Chart.js adapter ignoresdj-idwhen deciding to redraw. Proved in Chromium bytests/playwright/test_widget_contract_4322.pywith the shipped Chart.js adapter and an in-repo contenteditable editor fixture (Chart.js is a test-only devDependency) over WebSocket, SSE, HTTP-only and a nonce-only CSP.djust_vdombuilds without Python. The crate's PyO3 bindings are now behind a default-onpythonfeature, and the pieces it shared withdjust_core(the error type, the HTML whitespace and raw-text rules) moved to a new Python-freedjust_basecrate. A Rust host can depend ondjust_vdomwithdefault-features = falseand get the parser, the differ and the patch types with no Python interpreter in the build. Nothing changes for djust itself:djust_corere-exports every moved item under its old path. CI checks that PyO3 stays out of that dependency graph and runs the VDOM tests against it.
Changed
dj-hooklifecycle contract (#3656). The hooks guide now states when each callback runs ("The lifecycle contract": one instance per element node,mounted()/destroyed()exactly once,beforeUpdate()before an update's first DOM change,updated()after it,destroyed()beforemounted()/updated()in document order,dj-update="ignore"regions, connection callbacks, error isolation), and the client follows it, under the full and the core bundle. Changes: a hook nested in a hook element that an update inserted no longer also getsupdated()in that update;destroyed()can no longer run twice when it re-entersdjust.updateHooks(); a hook removed with adj-removeexit transition getsdestroyed()when the element is finally removed rather than at the next update;disconnected()runs once per lost connection instead of once per failed reconnect attempt,reconnected()only on hooks that gotdisconnected(), and both now also run over SSE (and when the client falls back from WebSocket to SSE);reconnected()also runs on the first WebSocket open after a failed first handshake, and on the first answered event of the page-POST HTTP fallback; a hook mounted while offline getsdisconnected()aftermounted(); a hook registry entry that is not an object no longer stops the other hooks from mounting.djust.updateHooks(root)with a root other than the document no longer destroys the hooks outside that root.- One
renderframe per turn, witheffects[](#3658). Every turn result now reaches the client as one{"type": "render", ...}frame on the WebSocket, over SSE and as the HTTP answer body. Its DOM part is at most one ofpatches,html, orview_id+html(an embedded child); a frame with none of them acknowledges a turn that changed nothing. The side effects a handler queued (push_event(),put_flash(),page_title/page_meta,set_layout(),live_patch()/live_redirect(), and the auth or refusal redirect) ride in itseffectslist, always in the order push events, flash, page metadata, layout, navigation. A skip-render turn now sends its effects in the same order as any other turn. Effects queued by adefer()callback are sent in the same turn, in one extra effects-only frame (source: "deferred") that the client applies after any server frame it is still holding; before, apush_event()from a deferred callback waited for the next turn.flush_push_events()sends asource: "flush"frame, which the client applies on arrival. The views queue every effect on one outbound queue (CommandsMixin); the public methods are unchanged. Custom JavaScript that read the old frames or the_*answer keys must read therenderframe's DOM part andeffects(hooks,djust:*events and{% dj_flash %}are unchanged), and tests that read frames match"render"and readeffects. See "The wire format changed" in the 2.0 migration guide and the new Wire Protocol page. - A connected view keeps a 16-byte digest per attribute for change detection, not two fingerprint trees (#3998). The dirty-tracking baseline, the last render's fingerprints, the request-scoped fingerprints and
@computed's dependency key now hold a BLAKE2b-128 digest of each structural fingerprint instead of the tree itself, so what change detection keeps no longer grows with the state: for a 1,000-row table it fell from 370 KB to 1.5 KB, and the Python heap one open page retains (tracemalloc) from 907 KB to 548 KB. Every change the tree comparison detected is still detected (equal digests mean equal fingerprints);0.0against-0.0is now also seen as a change. A set is fingerprinted in a canonical order, and astr/int/float/bytessubclass by its builtin value. The scaling guide publishes per-view memory against page size and two ceilings, both test-backed: under 2 MB for a view of a 100 KB page of markup, under 4.5 MB for a 100 KB table whose rows are all in state. - The Rust sync takes the post-event snapshot's walk of a list instead of walking it again (#3999). When a handler changes a container, the snapshot taken after the handler has already walked it; the state sync now uses that walk as the container's fingerprint, and as the answer to "is this plain data", so it skips both its own fingerprint walk and the
_collect_sub_idswalk, and converts a changed list for the renderer in a walk that builds no fingerprint. A turn that changes something else no longer walks the list in the sync at all. The reuse applies only when no application code runs between the snapshot and the sync (noget_context_dataorget_render_only_contextoverride, template property, class-level component orsync_turn_wrapper), and only to the very object the snapshot walked, in the same turn; otherwise the sync walks as before. One changed cell in a 1,000-row list: the sync's Python time fell from 7.8 ms to 4.5 ms and the turn from about 24 ms to 21 ms (p50,nosave, WebSocket); the issue's 10 ms target is not met, and the rest (item-level deltas for keyed lists, a two-region Rust fast path, per-render state-backend serialization) is follow-up work. Numbers indocs/performance/turn-transports-baseline.md. - The HTTP fallback's DOM shape follows the change (#4001).
domShape, which the page-POST fallback computes before every request and again before it applies a patch answer (#4108), keeps each element's piece of the shape with its CRC-32 and Adler-32 and combines them (zlib'scrc32_combine/adler32_combine); aMutationObserverforgets the pieces a change makes stale (and every piece in a subtree that is inserted again), and nothing in or around a<template>is kept, since its content is not observed. The value is byte-identical to the server'sdom_shape, held there by seeded random pages and edits. On a 1,000-row table (6,000 elements) a fallback turn's send goes from 9.5 to 1.3 ms p50 in headless Chromium and the check before applying from 9.5 to 0.8 ms. - Client work per patch follows the change, not the page (#4001, slice 1).
applyPatches(patches, rootEl, applyIf, changes)fillschangeswith what the batch changed (inserted and removed roots, changed attributes, text-only updates; recorded with aMutationObserver, so every insertion path is covered) and still resolves to its boolean. After a patch frame,reinitAfterDOMUpdatescans only those fordj-window-*/dj-document-*declarations anddj-modelbindings instead of walking the whole page (querySelectorAll('*')plus an attribute loop per element); a change that adds, removes or re-marks a LiveView root still scans the page, as do mount, morph and navigation. ASetTextpatch now carriesparent_d(the parent element's dj-id) andindex(the text node's place among its significant children), so the client finds the node with one id lookup instead of walkingpathfrom the root; aSetTextwithout them still resolves bypath, and the page-POST fallback strips both, as it strips the other id hints. Measured with the newscripts/bench_client_patch_turn.py(headless Chromium, unrelated counter update, p50): 0.2 / 0.6 / 6.0 ms at 100 / 1,000 / 10,000 elements before, 0.2 / 0.3 / 1.6 ms after. One behaviour change: adj-window-*/dj-modelattribute that page JavaScript (not a patch) adds to an untouched element is no longer picked up by the next patch's rescan; it is at the next full scan (mount, morph, navigation). - One renderer per
djust.components.uisimple component; the Rust simple-component crate is removed (#4002).Alert,Avatar,Badge,Button,Card,Divider,Icon,Modal,Progress,Range,Spinner,Switch,TextArea,ToastandTooltiprendered through a native class from thedjust_componentscrate, fell back to an inlinetemplatewhen the crate refused a value (a lazy string), and carried per-framework_render_customf-strings no render reached. Each now has one renderer, a Python_render_customthat draws the crate's markup byte for byte (pinned against 284 renders captured from the crate,python/tests/test_ui_simple_golden_4002.py).Checkbox,Input,ButtonGroupandOffcanvaskeep their template and lose the unreachable_render_custom. The crate (about 4k lines) and the 15djust._rust.Rust*classes are gone: measured per construct-and-render the Python renderer is 1.6x-2.9x faster than the crate path was (docs/components/RUST_COMPONENTS.md,scripts/bench_ui_simple_components.py). Three fixes come with it:Tooltipwrites the space beforetitle=the crate dropped, and an explicitid=onRange,SwitchandTextAreais the element'sidand the label'sfor(the crate usedname).Component.__init__now sets the constructor kwargs as attributes whether or not the class names a_rust_impl_class, andupdate()no longer passesstateto a native constructor. Alert,Badge,Button,Card,Dropdown,Modal,ProgressandSpinnerindjust.components.uirender through their ui*Componenttwin, so their HTML changed (#4002). Each maps its arguments onto its twin's (AlertComponent,BadgeComponent, ...) and returns the twin's markup, which followscss_framework. Every simple argument still works: one the twin has no equivalent for (Badge.size,Card.variant,Modal.centered,Modal.dismissable=False,Spinner.sr_text, anAlertvariant outside info/success/warning/danger/error, aBadgeorButtonvariant outside the eight Bootstrap colours,linkincluded) raises aDeprecationWarningfrom the constructor and fromupdate(), and is not drawn. Text is still escaped whatever it is marked as. What changes on a page: each element carries anid(the class'sid); a shownModalisshow d-blockwith a backdrop and always draws its header and a default "Close" footer; aCardheader is the card title; the defaultBadgelosesfs-6. To keep the simple classes working without a view, the twins gained three things:DropdownItem(url=..., disabled=...)(the URL checked and escaped like any other; adatavalue with ajavascript:,vbscript:ordata:scheme, under any key, is written as#), andstandalone=TrueonAlertComponent/ModalComponent, which the simple classes pass, so the Bootstrap close controls aredata-bs-dismissand a hidden Bootstrap modal is drawn hidden fordata-bs-toggleinstead of as nothing; under Tailwind and plain a standalone alert or modal draws no close controls, and a hidden standalone modal renders nothing with aUserWarning. A registered component's output is unchanged.SpinnerComponent's Bootstrap class list no longer has a doubled space. The per-class list is under "Markup that changed" indocs/website/guides/migrating-to-2.0.md. The other 21 simple classes have no ui twin and are unchanged.- The injected client is a core bundle plus chunks loaded on use (#4007). The LiveView now injects
client-core.min.js(about 11 KB smaller gzipped than the single bundle;make sizesprints both) and loads the uploads, virtual-list (dj-virtual), cursor-overlay, tutorial-bubble and service-worker modules fromstatic/djust/chunks/only on pages that use them, before the client binds and connects; a page that uses none loads none. Each chunk<script>carries the client tag's CSP nonce, and its URL comes fromstatic()(hashed names underManifestStaticFilesStorage).djust.uploadsanddjust.registerServiceWorker()work as before: until the chunk loads they are stubs that load it and forward. A feature that a patch orlive_redirectrenders after init loads its chunk then, and a view that declares uploads loads the uploads chunk when it mounts. A chunk request that fails or stalls for 10 s is reported once and the page starts without it.LIVEVIEW_CONFIG = {"client_bundle": "full"}injects the singleclient.min.jsinstead; a hand-written<script src="{% static 'djust/client.js' %}">keeps loading the full bundle. See the client bundle guide. max_entriesnow counts finished uploads that have not been consumed (#4118). A slot holds a finished upload againstmax_entriesuntil the view consumes it withconsume_uploaded_entries()or drops it withcancel_upload(); a failed upload does not count. Before, only uploads in flight counted, so a slot accepted any number of finished files. An app that never consumes its entries (common withwriter=, where the writer already stored the file) and usesmax_entries=1now refuses the second upload on the same connection ("Upload rejected"). Consume or cancel entries once you have handled them, or raisemax_entries.DJUST_STATE_SAVE_INTERVALdefaults to 2 seconds (#4164). WebSocket and SSE turns now answer before their state is saved, and the state reaches storage within 2 seconds of the first unsaved change, at the connection's close, before a navigation, and at the ASGIlifespanshutdown. Measured withtests/benchmarks/test_explicit_turn_cost_3997.py, a turn with an interval costs about what a turn with no save costs: 3.4 ms instead of 5.2 (counter), 5.0 instead of 7.9 (dashboard), 18.6 instead of 26.6 (500-row table). The gain is the same for any interval above 0; 2 seconds keeps what a killed process (or a daphne stop) can lose to about one user action and a busy connection's writes to one per 2 seconds. Turns that navigate, writerequest.sessionor ask (@event_handler(save=True),self.save_state()), views withpersist=fields,DJUST_STATE_STORE_STRICTand the HTTP fallback still save before the reply. SetDJUST_STATE_SAVE_INTERVAL = 0(or a view'sstate_save_interval = 0) for the 1.x behaviour.- Strict event parameters are the default (#4189).
LIVEVIEW_CONFIG["event_parameter_policy"]now defaults to"strict": a handler whose parameters are unannotated, start with_or are namedview_id/component_idis refused until it is converted (djust.V033lists them). @event_handler(parameter_policy="strict")is accepted and does nothing (#4205). Strict is the only policy, so the argument is informational and no longer published to the browser. A binding whose handler the mount's contract does not list sends only itsdj-value-*and positional arguments (neverdata-*or generated values); the server refuses an unknown handler. Adata-view-idattribute is no longer adjust.T022finding, since strict never sendsdata-*(dj-value-view-idstill is).djust_exposure_inventoryreports what a djust 1.3 view exposed, not a legacy runtime (#4206). Its JSON loses each name'sconditionalkey and the per-viewpersists_todayflag, the text report loses itsreconnect: fresh mountnote and is headed "Names a djust 1.3 view exposes implicitly", and both destinations are described as 1.3 behaviour;--fixis unchanged. The last internal legacy-exposure predicates (uses_legacy_exposure,require_legacy_state_api) are deleted, and a sticky or embedded child's ancestry now accepts only explicit-policy ancestors.- The SignaturePad's
max_bytesdefault and ceiling is 60,000 (#4207). The strict event collector refuses a text value over 65,536 characters, so the old 200 KB default produced a "Signature saved" status for a frame that never left the browser. The hook now clamps its cap, reports a refused send in its status region, and adj-pollinside a component reaches the host view again unless the component's own contract lists the handler. - Partial render reuses the children of a top-level
{% if %},{% with %}or{% block %}, and a tag that reads only its arguments (#4315). A wrapper that re-renders (its condition read a changed key, or it holds a custom tag or{% include %}) now renders its body child by child, reusing each child whose own inputs did not change, so a{% for %}nested in{% if show %}is no longer redrawn when only a sibling's key changed (the #4124 repro: 21 filter calls on acountchange, now 0). A binding child (as <name>, an assign tag, an include) or an earlier binding node still re-renders the children after it. A tag handler can declareREADS_ONLY_ARGS = True(withALSO_READSfor any context name it reads besides its arguments); a use that binds nothing then depends on its operands instead of re-rendering on every partial render.{% url %}(which also readsrequest) and{% static %}declare it;{% now %},takes_contexttags, raw@register.tagnodes and Django librarysimple_tags do not. - A connected view holds about a third less memory (#4319). The Rust
side keeps the same data in smaller shapes: an element's attributes are a
sorted vector rather than a hash table (
djust_vdom::Attrs, the same map API, iterating in name order); a node'stext,key,djust_idandcached_htmlareOption<Box<str>>rather thanOption<String>; a value and a dict key in the Rust copy of the state are 40 and 32 bytes rather than 80 and 48 (Value::Objectand the name and fields ofValue::NamedTupleare boxed, as isObjectKey::Other); and the text-region index keeps positions only and reads each node's text from the tree. A ~100 KB table with its 880 rows in state went from 4.19 MB to 2.69 MB per view and a ~100 KB page of markup from 1.49 MB to 1.03 MB; the table's ceiling intest_view_memory.pydrops from 4.5 MB to 3.0 MB, and the scaling guide's per-view memory formula and tables are re-measured. Nothing sent to the browser changed: patches, wire snapshots and the regenerated VDOM diff fixtures are byte-identical (the provenance site inventory,provenance_flatten_sites.txt, changed only because the source lines it lists did). The target for a ~100 KB table is revised from the provisional 2 MB to the 3.0 MB ceiling (measured 2.69 MB): the Rust copy of the state that remains is deliberate, since rebuilding it from Python on every turn would cost about 3.7 ms for 1,000 rows, against the one changed row a list-item delta converts now. - Change detection digests plain data natively (#4325). The pre/post event snapshot and the Rust state sync no longer build a Python fingerprint tree and BLAKE2b-hash it for a container of plain data (exact
dict/list/tupleof builtin scalars): one Rust walk (djust._rust.plain_digest) returns a keyed 128-bit digest, plus per-row digests a list's item delta compares. Anything else (a model, a set, a subclass, an oversized or too-deep value) is walked in Python as before, so a value's kept fingerprint is always the same kind. On the 1,000-row one-cell benchmark the WebSocket turn p50 drops by about 5.5 ms (15.6 to 10.0 ms, interleaved runs on a shared 4-vCPU container). Thenative_fingerprintsper-turn switch turns it off for the frame oracle. - A
{% for %}re-renders only the items that changed (#4325). Rust keeps the HTML of each item of an outermost loop from the previous render, keyed by index and a 128-bit keyed hash of the item value, and reuses it when the item, the list length, the render settings (autoescape,string_if_invalid, l10n, timezone, dj-if markers) and the loop's place in the template are all unchanged. A body that reads anything but the loop variables andforloop, usescycle,ifchanged,regroup,include, a nested loop that reads anything but the loops' own variables (see the nested-loop entry), a custom or time-dependent filter, or a value with a safe/unsafe mark, always renders; so does an item whose render read Python live. A loop not rendered for 64 renders is dropped. Switch:djust._per_turnloop_item_render. A seeded differential fuzz (DJUST_FUZZ_4325_SEEDS) checks it against a full render and catches a deliberately broken store. - A turn no longer scans a context list for a Model or QuerySet when the post-event snapshot already proved that very list is plain data (
plain_model_scansper-turn switch). Saves about 0.5 ms per turn on a 1,000-row list (#4325). - The per-item loop store keeps rows with nested loops (#4325). A
{% for %}whose body holds a nested{% for %}reading only the loops' own variables (andforloop) now has its unchanged rows served from the previous render, as a flat body already had; before, such a table re-rendered every row on every change. A loop nested in a row being stored renders without the per-item content cache, so its parse placeholders are never stored. On a 1,000-row table with a nested loop per row, one changed cell takes about 17 ms per turn instead of about 30 ms. Switched bydjust._per_turn(loop_item_nested) for the frame oracle. - Cheaper render tail for a one-cell change in a large list (#4325). The text-region fast paths of
render_with_diffnow decide against the previous VDOM without touching it and then rewrite its changed text nodes in place, instead of cloning the whole tree (about 6,000 nodes for a 1,000-row table) and dropping the old one. The per-item loop store hashes each item in one walk that feeds both of its keyed hashers, and appends a stored item's HTML without copying it first. Output, patches and store hits are unchanged. On the 1,000-row table with one changed row,RustLiveView.render_with_diffdrops from about 3.4 ms to about 1.6 ms (parse phase 0.9 ms to 0.05 ms). - A handler that changes a few rows of a long list sends Rust only those rows, and a render that changes several text nodes skips the parse (#4325). When the event snapshots show that only some rows of a list changed in place (at least 16 rows, at most a quarter changed, same object and length), the state sync converts just those rows and replaces them with the new
RustLiveView.update_state_items, instead of converting and sending the whole list. Any other change, or a refusal from Rust, takes the whole-list path (switch:djust._per_turnlist_item_deltas). The text fast path inrender_with_diffnow also takes a diff that touches up to eight text nodes, not only one, and falls back to the full parse on any doubt. One changed cell in a 1,000-row list: turn p50 about 22 ms to 20.5 ms over the WebSocket, with the sync's Python time down from 5.1 ms to 2.3 ms; a two-cell change renders in about 8 ms instead of 15 ms. The per-render state-backend serialization the issue asked about no longer happens (measured: 0 calls per turn). Numbers indocs/performance/turn-transports-baseline.md. - Post-patch rescans and hook updates follow the change (#4328, #4001 slices 2 and 3). After an incremental patch, every rescan in
reinitAfterDOMUpdate/bindLiveViewEvents(dj-poll, dj-click-away, dj-shortcut, dj-mouseenter/leave, dj-mounted, dj-loading registration, native dropdown observers, dj-upload / dj-upload-drop, dj-patch / dj-navigate andaria-current, draft fields anddata-draft-clear, colocated hook scripts, offline indicators, dj-scroll-into-view, chunk loading) visits only the subtrees the patch inserted and the elements whose attributes it changed; dj-virtual and dj-viewport-* rescans are skipped on a page that tracks none and the patch inserts none. The page is still scanned on mount, morph, navigation, a reconnect, a patch that adds/removes/re-marks a LiveView root, and the first patch after a batch applied without a change record (a child or sticky view's update, a cached answer). Hook contract change: after an incremental patch,updated()runs only for hooks whose element or subtree the patch changed; a hook definition withupdateOn: 'render'keeps getting it after every render, and a full morph still updates every hook (docs/website/guides/hooks.md, rule 4). What changed between patches is bound by the next one, as when every patch scanned the page: one long-lived observer adds the elements inserted or re-attributed outside any patch (by a hook'smounted(), app code, a virtual list's scroll render) to the next patch's record, and adj-hookelement seen before its hook was registered mounts on the next update once it is. Also: aSetTextresolved byparent_dlooks the parent up inside its own view (a{% live_render %}child or sticky view numbering the same dj-id is skipped) and leaves a parent inside a[dj-virtual]list to the path; the page-POST fallback strips id hints insideVirtualUpdatepatches too; the scoped dj-model rebind bindsdj-model.debounce-Nonly on the elements the full scan does. Unrelated counter update, headless Chromium, p50: 0.2 / 0.3 / 1.6 ms at 100 / 1,000 / 10,000 elements after slice 1, 0.1 / 0.2 / 0.2 ms now. accordion,accordion_item,form_arrayandapp_shelldraw through one renderer on both engines (#4331). The Django nodes render their body and call the native handler, so a template draws the same bytes under Django's engine and the Rust engine. An accordion item opens when the accordion'sactivenames it or its ownopen=is true, takes the accordion'seventunless it sets its own, and body that is not an item is kept. The accordion uses thedj-accordion*markup on both engines (the Rust engine drewaccordion-item/accordion-trigger), always draws each panel (hiddenwhile closed), and escapes a marked-safe title.form_arraytakes the raw-body route on the Rust engine, so its body repeats once per row there too (the body is compiled by Django's engine, astabs' is, so it cannot hold a Rust-only tag such as{% call %}).{% badge %},{% avatar %},{% progress %}and{% pagination %}are one implementation on both engines (#4331, #4002): the native handler draws thedj-*BEM markup (dj-badge,dj-avatar__img,dj-progress__fill,dj-pagination__btn...) and the Django tags are simple tags that call it, as{% data_table %}has since #3869. The Rust engine's output moves off the oldbadge-<status>,avatar-image,progress-wrapperandpagination-btnclasses (the pager's "Page N of M" text is gone); the Django engine now escapes a marked-safe operand and no longer reproduces the inclusion templates' newlines.filter_bar,filter_select,filter_date_range,filter_searchandpage_headerdraw through one renderer on both engines (#4331, #4002 slice 4). The Django{% filter_bar %}default id is now the constantfilter-bar(it was random per render), a marked-safe or lazy operand is escaped like any other string (as the Rust engine always did), and a{% page_header_actions %}that draws nothing leaves no emptydj-page-header__actionsdiv on either engine.- Layout tags draw through one renderer (#4331).
app_sidebar,app_header,app_content,toolbar_separator,toolbar_overflowandpage_header_actionsare thin Django wrappers over their native handlers, asdata_tableis (#3869); the markup is unchanged. Standalone, the Djangoapp_*,toolbar_separator,toolbar_overflowandpage_header_actionstags now draw their own element instead of an empty string. sidebar,nav_menuandtoolbardraw through one renderer (#4331).sidebar,sidebar_item,sidebar_section,nav_menu,nav_itemandtoolbarare thin Django wrappers over their native handlers, so both engines draw the same bytes. Under the Django engine: body content in a{% sidebar %}that is not an item is kept, a{% sidebar_item %}body is its submenu whatever it holds, thedj-sidebar__item--level-Nclass is gone, a marked-safesidebar_sectionlabel ornav_menubrand is escaped, a{% nav_item %}outside a menu draws its item, and an item without anidis no longer drawn active when the sidebar has noactive=. Under the Rust engine the sidebar'sactive=now reaches its items, andsidebar_item active=Truemarks that item. A{% toolbar %}with noid=getstoolbar-<hash of its arguments>on both engines (it was the constanttoolbarnatively); two identical calls in one Django render no longer get a-2suffix.- Rust dependencies: PyO3 0.30.1, smallvec 1.16.6, stacker 0.1.25, uuid 1.29.3. No API changes in djust; the SBOM (
djust.cdx.json) is regenerated.
Fixed
- QuerySet:
{{ u.groups.all.0.name }}reads one row, and{{ u.groups.all|length }}/{% if u.groups.all %}build no row text (#3862). The template extractor keeps an index read off a related manager'sallwhen it is the only read of thatall(groups.all.0.name), and both queryset serializers readall()[:index + 1](a SQLLIMIT, or a slice of a prefetched cache) instead of serializing every row of the relation. A read of anallfor its length or truthiness only (|length, a bare{% if %}/{% if not %},|lengthin a comparison) is filed asgroups.all.__len__and ships the QuerySet'scount()as placeholders, sostr(row)no longer runs per row; forPermissionrows, whose__str__readscontent_type, that removes one query per permission. Beside any other read of the sameallboth reads keep their previous shape.template_paths()anddjust_auditstill report the plain read (groups.all,groups.all.name). - Uploads:
max_entriescounts finished uploads, a writer's refusal reaches the browser, and the view'scancel_upload()settles the browser's upload (#4118).max_entriesnow counts every entry the slot holds, finished ones too, until they are consumed or cancelled, as documented (a slot withmax_entries=5used to accept any number of finished uploads); a failed upload does not count. A newdjust.uploads.UploadRefused(anUploadErrorsubclass) raised from a writer'sopen(),write_chunk()orclose()is a refusal: it is logged at WARNING without a traceback, and itsmessage, one line of at most 200 characters, becomes the upload's error, theerrorin thedjust:upload:progressdetail and theuploadFile()rejection message (neversdk_exc). Every other exception, including the object-storage backends'UploadCredentialError/UploadNetworkError/UploadQuotaError, keeps the fixed text and the logged traceback.UploadMixin.cancel_upload()now tells the browser at the end of the turn (statuscancelled, "Upload cancelled by the server."); the client rejects the pendinguploadFile()promise on acancelledstatus and stops sending chunks for an upload the server ended. - Theming: a design system can now set the monospace font (#4119) —
TypographyStyle.mono_font(default unchanged) is written to--font-mono, and the basecode, .coderule usesvar(--font-mono)so a theme or app override reaches<code>as it does.kbdand.font-mono. - A
start_async/@backgroundresult that changed nothing no longer renders the whole template (#4123). The result paths (the runtime's_render_async_resultand the consumer's background render) synced and rendered unconditionally; with no changed key Rust took its "no change info" branch and rendered the full template to sendpatches: [], which happened on every later completion when several tasks finished close together._sync_state_to_rust()now returns whether the next render has anything to do (Falseonly when no key changed or was removed since the last sync, no render was requested, and no context value is an object the change detector compares only byid()), and an async result (and its error arm, when ahandle_async_resultran) skips the render and the frame when it says no and the frame's snapshot fields hold nothing new (no client-persisted token, same turn serial as before the commit). The rule for the skip: it never drops what the unconditional render delivered, so an opaque value (a plain object whose attribute a callback writes in place) always renders, as before; a failed task with no handler and a cancelled task's settle frame are still always sent. Pending work (push events, deferred callbacks) is still flushed, and the client's loading state still ends with the batch'sasync_completeframe. A result that changes state, throughhandle_async_resultor by mutating a list in place in the callback, still patches. - Partial render no longer redraws an unchanged
{% for %}(or any later node whose inputs did not change) after an inline{% url %},{% static %},{% now %},{% querystring %}, context-freesimple_tag/inclusion_tagor component tag used withoutas. "Reads unknown keys" (the tag re-renders itself) is now separate from "may bind names" (later siblings re-render); assign tags,as <name>forms, raw@register.tagnodes,takes_contexttags and{% include %}still re-render what follows. Handlers opt in with the newTagHandler.BINDS_ONLY_AS_VARdeclaration (#4124). - With
DJUST_STATE_SAVE_INTERVALset, an HTTP fallback request that changes nothing no longer takes the tab from its socket (#4164). It used to record a holder token on restore, whichSessionMiddlewarestored, so the socket's later flush of its newer, unsaved changes was refused and the page told to reload. A fallback request now claims the tab only with a save that changes the stored state; one that does still fences the older socket out. - A reconnect's request to save reaches the old connection in the same process without a channel layer, and its failures no longer drop the change (#4164). The holder in this process is asked directly; one in another process still needs a shared channel layer, and new system check
djust.C046(info,DEBUGoff) says so when the interval is on and the layer is missing or in-memory. A flush request is now retried like the interval's (one refusal keeps the change owed) and waits at most 0.5 s for the turn locks. A reconnect whose storage already caught up reads its session again, astate_serialmore than one past the store is ignored, and an SSE stream's close untracks presence before its state flush. - The session write of an over-limit turn is ordered with the connection's
other saves and bounded by the save deadline (#4164). With
DJUST_STATE_SAVE_INTERVALset, a turn that asked for its save (save=True,save_state(), arequest.sessionwrite) and whose state was over its size limit stored its session writes outside the runtime's save queue, with no deadline: it could land before an earlier save still running. It now goes through the same queue; past the deadline the turn is served and the write lands in order. - An event queued on a hidden activity inside an embedded child is delivered to the child (#4179).
A
{% live_render %}child's event sent to a hidden{% dj_activity %}of the child ran at once, and a child's queue was never drained. It is now queued on the child and released by thedb_notifydrain and the event-turn drain (the child's own handler, the page's handler orhandle_infoshowing the panel), with the checks of the child's own events, anembedded_updateanswer and the socket kept open. A release for a child no longer on the page is dropped. - Debug logging no longer aborts event dispatch.
djLogswallows a throwing page-installedconsole.loghook; strict event params are null-prototype objects that a hook doingargs.join(" ")cannot stringify, which dropped every event underdjustDebug. (#4189) run_pre_mount_authno longer resolves and binds the tenant a second time on an explicit view that mounts: the tenant is resolved once, before authorization.- An explicit view no longer keeps stale QuerySet-method rows across renders — the evaluated rows behind
{{ qs.count }}-style reads (_all_method_rows) are rebuilt on every real context evaluation, so a name that stops holding a QuerySet releases them instead of answering a later value from them (#4196) - An
AudioMixinview's_audio_attributes are never saved by automatic state (#4197). The mixin documents its_audio_namespace (scope, cursors, the manifest cache) as ephemeral, but only the legacy private-state API honoured that: on an explicit view an application cursor such asself._audio_cursorset inmount()was saved with the automatic state and put back on the next request. A mixin can now declare_djust_unsaved_prefixes, a tuple of private-name prefixes automatic state neither saves nor restores;AudioMixindeclares("_audio_",). date/timematch Django at DST gaps and folds, for local-mean-time offsets and at the ends of the calendar (#4222). A wall clock that falls in a DST gap or fold (in the active zone, or in the value's own zone after|timezone:, inside{% localtime off %}or underUSE_TZ = False) now renderse,T,O,ZandIempty, as Django does, andU/rread it with the pre-transition offset (previouslyEDT/-0400for a fold and+0000for a gap).Otruncates a seconds offset whilecandrprint it (-04:56:02),Yis zero-padded (0001), andUis exactlyint(dt.timestamp()): correctly rounded, then truncated toward zero.- A patch-compression
html_update(more than 100 patches, HTML smaller) no longer drops the VDOM baseline, so the next event is answered with patches instead of full HTML again. Over SSE the follow-on frame also kept a consecutive version (the reset restarted it at 1 and the client fell back to recovery). The page-POST fallback keeps its renderer's baseline the same way (#4229). - On the page-POST fallback, a whole-page answer chosen for its size after the client's render token matched is marked
whole_page: "size", and the client no longer counts it as a digest miss, so two such answers in a row no longer withhold the token for the next eight events (#4229). djust.V002no longer reports a view with nomount()that declaresstate()fields (#4233). Such a view initialises its state through the descriptors, so the "define mount()" advice did not apply.djust.T010also flagsdj-clickwithdj-value-view,-tab,-pageand-section(#4237). These send the same navigation state as thedata-*forms. The match now stops at the end of the attribute name, sodata-viewport,data-views,data-tab-id,data-page-numberanddata-view-idstyle names no longer trigger a false positive (no template in this repository was affected).- _on_sticky_update works for explicit sticky children; the Sidebar example is fixed (#4238).
The hook was never reached for an explicit sticky child (every input change
remounted it), and the sticky guide's
Sidebarexample setself.sectionwithoutstate(), which an explicit view never renders. The child now names its updatable inputs insticky_update_inputs, and the example declaressection = state("home"). - The binding check models
dj-value-*on fixed-payload directives (#4240).dj-viewport-top,dj-viewport-bottom,dj-mutation,dj-copy-event,dj-dialog-close-event,dj-auto-recoveranddj-pastecollect the element'sdj-value-*on the strict path, sodjust.T020now reports a name the directive generates itself (the browser rejects it), an undeclared value, and a required parameter adj-value-*supplies. Legacy handlers are unchanged. dictsort/dictsortreversedby a method key the template also prints renders empty, as on Django (#4267).{% for u in users|dictsort:'get_username' %}{{ u.get_username }}{% endfor %}sorted the rows by the called value, because a path-JIT row files a called method's result where a column would be; Django'sdictsortnever calls a method key, compares bound methods and renders""(one row is never compared and still renders). For a template that sorts by a method it also prints (the newextract_printed_item_key_reads, or adictsort:<variable>naming a method), the JIT re-keys that entry of each row as adjust.serialization.CalledName(astrsubclass), which the engine reads asObjectKey::Method: astrkey everywhere except the engine'sdictsort, which hands Django an unorderable object for it. Rows of every other template are untouched. Explicit LiveViews andDjustTemplateBackend,QuerySetandlist[Model]rows.- A related object printed whole beside a field read off it prints its text, not a partial dict
(#4269).
{% for p in perms %}{{ p.content_type }} {{ p.content_type.model }}{% endfor %}printed{'model': 'logentry'}where Django prints the object's__str__: the extractor filed a whole read only for a one-segment variable, so the nested dict carriedmodelalone. A dotted whole read is now filed too and settled intocontent_type.__str__when the same path is read by field (not when it is iterated, tested in a condition, bound by{% with %}, indexed, or a relation'sall/first/last); both row serializers already answer it with the floored model identity. A non-model value read whole beside a field ({{ u.date_joined }}with{{ u.date_joined.year }}) prints Django's localized text. {% for u in users.all %}and{{ users.all.count }}over a top-level QuerySet in LiveView state render Django's rows and count (#4270). They rendered empty on both exposure policies: the JIT serialized each row with anallsubtree no row has, and the render sidecar held the QuerySet only forcount/exists/first/last.allis now a QuerySet root method the sidecar answers (QUERYSET_ROOT_METHODS), and the row paths readall.xasx. The sidecar'sall()answers from the rows the JIT already fetched (with their prefetched relations), so{{ users.all.count }}adds no query and a nestedu.groups.allloop underusers.allcosts what it does underusers.- A legacy LiveView renders
.values()/.values_list()rows held in state like Django (#4271).{% for r in rows %}{{ r.username }}{% endfor %}overUser.objects.values("username")printed;;;onexposure_policy = "legacy": the legacy context serializer handed every QuerySet to the JIT's model serializer, which reads a dict row empty. A projection now skips the JIT and is listed by the normalize pass, as on an explicit view; its<name>_countkey stays. A projection names its columns, so it prints every column it names, as explicit views and Django do: a legacy.values("password")now prints the hash it used to drop (projections never had the serialization floor). - A method-read QuerySet whose rows read a related model whole no longer runs a query per row
(#4272).
{{ perms.count }}beside{% for p in perms %}{{ p.content_type }}{% endfor %}filedcountwith the row paths, so every row took the codegen fallback, which shipped theContentTypeitself;normalize_django_valuethen auto-called itsget_*methods (6 queries for 5 rows, 1 without the.count). The method paths a QuerySet answers are dropped from the row paths, and the codegen leaf ships a related model's text as the Rust serializer does. A QuerySet read only through its methods ships identity rows instead of building a serializer every render, and the expected-key count is computed from the row paths (its cache was keyed by template and name only). - A page that extends a base template answers its first HTTP-fallback event with patches on Django 6.0, not the whole page (#4283): the page GET now carries the render digest on the authenticated-root path, and the tracking flag alone no longer reads as an embedded child. The
test_the_markdown_stream_starts[http]demo test failed on 6.0 because of it. - A page with many interactive components no longer fails, and a small HTTP answer no longer carries the whole parameter-contract manifest (#4307).
Under strict parameters each DropdownMenu row repeated its handlers' contracts in the page's manifest,
so past about 90 rows the manifest went over its 64 KB limit and the page answered 500. The manifest
(wire version 2) now lists each distinct contract and handler table once, and each component only
names its table: a 500-row collection's manifest is about 9 KB instead of about 360 KB, and the page
renders and posts. A manifest the browser already holds is sent as its digest instead of in full, on
the HTTP fallback (the browser names it in
X-Djust-Parameter-Contracts), the WebSocket and SSE. A counter's patch answer goes from 875 bytes to 243. Bundle:client.min.js.gz88,622 → 88,916 bytes. - An event released from a hidden
dj_activitynow answers with its ownref, and everyasync_pendingnames itsasync_batch(#4309). A queued event (the root's or an embedded child's, released by an event turn or adb_notify) was answered without therefit was sent with, and thedb_notifydrain'sasync_pendinghad no batch token and its work sent noasync_complete. The client matched such frames by guessing from the last event sent, so a released answer could settle an unrelated pending request. The guess is gone: the client settles a request only by itsref, and ends background loading only on its batch'sasync_complete. An answer that sendsasync_pendingwithout a batch token now ends the loading state right away instead of leaving it on. - A rate-limited WebSocket event no longer leaves its request pending (#4309). The global rate-limit gate now puts the dropped event's
refon itsrate_limit_exceededframe, and the client settles that request: its loading state ends, itssendEventpromise resolves, and the tick, broadcast and async frames held back behind it are applied. {{ v }}of anOrderedDictthroughDjustTemplateBackendnow renders what Django renders (OrderedDict({...})) instead of a plain dict; key lookup, iteration and|dictsortare unchanged (#4313).- A
{% for %}loop variable is never reported as an unsupplied name (#4318). WithDJUST_UNSUPPLIED_NAMES = "error",{% for head in items %}{{ head }}failed every real request:template_paths()lists a loop variable as a root of its own, and Django'sView.setup()setsself.headon every view, so the check tookheadfor a name the view holds.template_paths()now folds a loop variable onto its iterable as its docstring says, and the attributesView.setup()adds (head,request,args,kwargs) no longer count as held by the view. The test client never callssetup(), which is why only a real request showed it. cached_dbsessions: a late save can no longer leave an older copy in the cache (#4324). The merging save writes the database under the row lock and touches the cache after the commit, outside the lock. It used to write the merged session there, so a late writer's cache write could land after a newer one's, and reads returned state one save older than the database until the entry expired. It now deletes the cache entry, which is the same in either order; the next read refills it from the database. Measured on PostgreSQL 16 with the late writer's cache step delayed: 0 stale caches in 20 rounds, where the old write was stale every time.- An inline if's filter argument is now a dependency (#4325). In
{{ a if c else b|add:x }}the template analysis ignoredx, so a partial render after onlyxchanged kept the old text. It is now tracked like a{{ b|add:x }}argument (#787). - A text value holding a NUL character now renders the same through the parse-skipping text paths as through a full parse (#4325 review). The parser drops a NUL in body text, but the fragment and single-span text paths of
render_with_diffsent it as is, so the page and the server's tree disagreed (q\x00againstq). Those paths now leave such a change to the full parse. - A text change that adds or removes the newline opening
<pre>or<textarea>text, or contains a CR, now reaches the browser as the parser reads it (#4325). The parse-skipping text paths ofrender_with_diffsent such a value raw (SetText "\nx"), where a full parse drops that newline and turns CR into LF, so the page and the server's tree could disagree. They now leave those changes to the full parse. - QuerySet
.allfollow-ups (#4326).- A QuerySet held inside a dict or a list of dicts now renders on a LiveView when the template reads its own
allor one of its methods:{{ d.users.all|length }},{% if d.users.all %},{{ d.users.all.1.username }},{{ d.users.count }}. Reading a QuerySet method next to a loop over a relation of its rows also renders ({{ x.groups.all.count }}beside{% for g in x.groups.all %}, withxfromd.users). Before, these rendered empty or0. The container now keeps a raw copy for the render sidecar, built from the rows the JIT already fetched, so no query runs twice. - A to-many relation read only through a method, by index or for its length is no longer prefetched whole when the parent QuerySet is sliced and (parent rows) x (distinct light reads of that relation) is at most
LIVEVIEW_CONFIG['queryset_light_relation_max_parents']. Each parent row then runs its ownCOUNT/LIMITquery instead. The default1never runs more queries than the prefetch would: one parent and one read replace one query with one.0always prefetches. {{ d.users.count }}/{{ d.users.exists }}on a QuerySet inside a container runs oneCOUNT/EXISTSquery, as Django does, instead of fetching every row.{% with n=u.groups.all|length %}is read as a length, so no row text is built.{{ u.groups.all.0 }}reads one row instead of the whole relation.- A relation's manager methods read without
.allrender on a LiveView:{{ u.groups.first.name }},{{ u.groups.last.name }}and{{ u.groups.first }}beside a field of it. Before, the JIT shipped{}forfirst/lastand they rendered empty. They now run under the same call guard and serialization gate as.all.first, in the Rust serializer and the codegen fallback alike.countandexistsalready worked and are now pinned too.
- A QuerySet held inside a dict or a list of dicts now renders on a LiveView when the template reads its own
- Accordion ARIA, the Rust engine's
form_arraybody and Django'sapp_shellbody (#4331). An accordion trigger'saria-controlsnamed a panel Django's engine did not draw while the item was closed, and the Rust engine's items had noaria-controls, panelidorrole="region": every trigger now controls a drawn panel withid,role="region"andaria-labelledby. The Rust engine'sform_arrayignored its body and drew a text input per row; it now repeats the body per row withrow,row_indexandforloop. Django'sapp_shelldropped content outside the slot tags; it now keeps it, as the Rust engine did. - Badge, progress and pagination fixes from the single renderer (#4331): the Rust engine's pagination now draws
<nav aria-label="Pagination">with labelled buttons and disables Next on the last page; its badge writes theStatus: ...text for screen readers; its progress class list has no trailing space; and a non-classcolor=such as#336699no longer leaks into the progress bar's class list on either engine (the default fill is drawn). {% toolbar %}groups the children between separators (#4331). The Django tag wrapped each template node in its owndj-toolbar__group, so<button>{{ x }}</button>was split across three divs, and the Rust engine drew no groups at all. Both engines now wrap each run of children between{% toolbar_separator %}tags (or the overflow menu, or an end of the toolbar) in one group.- An embedded child's
_cleanup_on_unregister()runs when the page navigates away, as it did for 1.3 children. Before, a navigation ran only_cleanup_uploads()and_on_sticky_unmount(), so whatever the hook frees (files, subscriptions) leaked until the socket closed. Each disposed view runs it once, including a sticky child the destination page drops. - Open CodeQL findings resolved.
djust.security.__all__names (get_max_age,DEFAULT_MAX_AGE) are now visible to static analysis,djust.live_viewno longer re-exports the unuseddecode_private_model_refs/decode_state_roundtrip/encode_private_model_refs(import them fromdjust.serialization) and exportsStateRoundtripJSONEncoderin__all__,AssignsSnapshot/ChangedKeysdefine explicit value equality, and two dead locals were removed.
Security
- The template engine's date filters and timezone conversion moved from
chrono+chrono-tztojiff(#4222). Both crates are marked unmaintained by RustSec (RUSTSEC-2026-0543, RUSTSEC-2026-0555);Cargo.lockno longer carries either, and theirosv-scanner.tomlexceptions are removed. The IANA tz database is bundled into the extension (no dependency on the host's/usr/share/zoneinfo). The RFC 3339 grammar and case-sensitive zone-name lookup are unchanged. Dates past 2037 now follow the zone's recurring DST rule, as Django does;chrono-tzhad stopped at its last precomputed transition. - Events routed to a LiveComponent or an embedded child view run the page view's per-event object-permission check on the WebSocket and SSE transports. The page view's
get_object()/has_object_permission()was re-run for the page's own events but not for an event carryingcomponent_id(or a child'sview_id), although such an event re-renders the page. Every view the event belongs to (the component's view, an embedded child's parents and the page view) is now checked before the handler runs; a refusal sends the samepermission_deniederror frame a page event gets, runs no handler and renders nothing. The HTTP POST event fallback already checked the page view first and is unchanged. dj-modelaccepts only fields bound in the branch the template rendered. Theupdate_modelallowlist was every staticdj-model="<field>"binding in the template source, across all{% if %}branches, so a field bound only inside a branch that was not rendered for a view instance (for example{% if user.is_staff %}<input dj-model="note">{% endif %}) was still writable by that instance's client. A binding now counts only when its template text rendered for the current state: bindings on always-rendered paths are granted as before, and a binding inside an{% if %}/{% for %}branch, an include or a lazy site counts while the last render emitted it. The bindings are recorded during the render itself (nothing renders twice; a node or loop served from a render cache contributes what it recorded when it rendered). A binding inside the body of a custom block tag (a Rust or library block tag,{% ifchanged %},{% filter %}, an inclusion tag's template) never counts, because the tag decides what of its body reaches the page: list such fields inallowed_model_fields, which is unchanged. New system checkdjust.T030warns about them (following a literal{% include %}in such a body), and a block-tag handler that always emits its body may declareEMITS_BODY = True: the built-in component tags that do (card,accordion,tabs,form_group,fieldset, the layout tags and the others indjust.components.rust_handlers.EMITS_BODY_TAGS) keep working unchanged, whilemodal,dropdown,await,nav_itemand{% call %}/{% slot %}bodies needallowed_model_fields. Embedded{% live_render %}children record the template text their render executed, under Django's engine and djust's own backend alike. Rendered data — an unquotedattr={{ value }}, adj-model="{{ field }}",|safeHTML — can never add a field.- Presence identifies an anonymous user by an opaque id instead of the session key.
PresenceMixin.get_presence_user_id()used to returnanon_<session_key>for an anonymous user, and that id is shared with every participant in the room (list_presences(), join/leave records, theLiveCursorMixincursor_movebroadcast andget_cursors()). It now returnsanon_<hmac>: 128 bits of an HMAC-SHA256 of the session key underSECRET_KEY(django.utils.crypto.salted_hmac, dedicated salt), via the newdjust.presence.anonymous_presence_id(). The id is still stable for the session, so tabs of one browser session still count as one presence. Withpresence_unique_per_connection = Truetheanon_conn_id is likewise an HMAC of the transport session id (anonymous_connection_presence_id()). An override ofget_presence_user_id()that returns a session key, or code that matched presence ids againstanon_<session_key>, should useanonymous_presence_id().
Documentation
- An incremental Django workflow, as a guide and a running example (#3659).
examples/demo_project/djust_workflowadds djust to an ordinary Django model one piece at a time: a list with a URL-backed filter and pagination (params_form,live_patch, back/forward), a detail page, create and edit forms with server validation (FormMixin,ModelFormMixin), login, role and object permissions,dj-loadingfeedback, a visible error state, and a table of what survives a reconnect. The new guideincremental-django-workflow.mdwalks through it, and a test fails when one of its snippets drifts from the example's source. - The deployment guide states what a graceful stop keeps under each ASGI
server, with
DJUST_STATE_SAVE_INTERVALset (#4159). Recorded per server bytest_what_a_graceful_stop_keeps_per_server(the multinode harness now runs a node under uvicorn, daphne, hypercorn or gunicorn +UvicornWorker, with the application answeringlifespan): uvicorn and gunicorn close the socket and runlifespan, so nothing is lost; hypercorn 0.18 keeps an open WebSocket open until the client leaves (its close saves) or the process is killed; daphne 4 delivers neither, so a graceful stop loses up to one interval. - A handler that sends the browser to another page with its own push event
is documented to use
@event_handler(save=True)orself.save_state()(#4160). Such a turn is not seen as navigation, so withDJUST_STATE_SAVE_INTERVALset it could be deferred and the next page load before the state was stored. The save-frequency guide says so, and a test shows both means store the state before the reply that precedes the push. - The holder fence under the row lock, measured (#4164). A late writer paused between its read and its write never lands in the database on PostgreSQL (
dbandcached_db, 300 rounds each) and lands every time on SQLite. Oncached_dbthe cache, written after the commit and outside the lock, can keep the older copy (once in 600 rounds).save-frequency.mdrecords all three, andtest_holder_fence_row_lock_4164.pyreruns the race whenDJUST_PG_RACE_DATABASEorDJUST_MYSQL_RACE_DATABASEis set. The per-turn cost with and without an interval is recorded there too, from the extendedtest_explicit_turn_cost_3997.py. - The state-survival guide has a table per save mode (#4164). Saved before
every reply against saved on an interval, each with a graceful-stop and a
kill column, every cell recorded by
test_save_mode_graceful_stopandtest_save_mode_killagainst real processes. - The 2.0 upgrade guide is rewritten around the legacy removal (#4208). Each 1.3 capability is shown with its 2.0 spelling, the system check that reports it (or the
ImproperlyConfiguredthat refuses it at import or startup) and whetherdjust_exposure_inventory --fixrewrites it; the retireddjust.V033/djust.T028are replaced bydjust.V016/djust.T020in the check table and the finish list, the guide no longer describes a legacy view as something 2.0 runs, and every code block in the guide is executed by the test suite. - Every teaching doc now passes event arguments as
dj-value-*, and the guard sees all of them (#4235).test_docs_pass_event_arguments_as_dj_valuescanned onlydocs/websiteand onlydj-click-style attributes; it now covers every document inDOC_FILESand thedj-click-away,dj-mounted,dj-shortcut,dj-window-*anddj-document-*bindings. 29data-*arguments indocs/EVENT_HANDLERS.md,docs/BEST_PRACTICES_AI.md,docs/ai/anddocs/components/becamedj-value-*, and the "**kwargsis required" section ofEVENT_HANDLERS.mdnow states the 2.0 rule (the signature is the contract). - Handlers in the docs no longer teach a
**kwargscatch-all they never read (#4239). 189 handlers in 61docs/websiteguides took**kwargsand dropped it, which teaches the retired 1.3 rule that a handler must accept every name. They now declare only the arguments their binding sends, handlers that read the catch-all keep it typed, andtest_website_handlers_have_no_absorbing_catch_allfails a guide that adds an unread**catch-all to a decorated handler.CLAUDE.mdanddocs/EVENT_HANDLERS.mdstate the same rule.
Removed
- The per-effect wire frames and the HTTP answer's
_*keys (#3658). Thepatch,html_update,noop,embedded_update,push_event,flash,page_metadata,layout,navigationandnavigateframes are gone, and so are the HTTP answer's_flash,_page_metadata,_push_events,_layoutand_navigationkeys. Their content is therenderframe's DOM part and itseffectslist; an effect is the old frame withtyperenamed tokind. - djust.react, ReactMixin and capitalized component tags are removed (#4006). Importing
ReactMixin,react_componentsorregister_react_componentfromdjustraisesImportErrornaming thedj-hookreplacement, and<Button />in a template is a template error (an uppercase spelling of an HTML element such as<DIV>is still HTML). The client'sinitReactCountersis gone. - The legacy exposure and parameter policies are refused (#4199).
exposure_policy = "legacy"fails when the class is created (and on construction),@event_handler/@server_function(parameter_policy="legacy")when the decorator applies,cancel_async_on_disconnect = Truewhen the class is created, andLIVEVIEW_CONFIG/DJUST_CONFIGevent_parameter_policy,reauth_on_eventandreauth_server_turn_intervalat startup, each withImproperlyConfigurednaming the replacement."explicit"andparameter_policy="strict"are accepted and do nothing.python manage.py djust_exposure_inventory --fixstill reads 1.3 code. System checksdjust.V028,djust.V032,djust.C045anddjust.V036are retired. - The legacy branches for embedded, lazy and sticky children are deleted (#4200). With
exposure_policy = "legacy"refused (#4199), every{% live_render %},dj-lazyand sticky child takes the explicit path: a lazy attribute child keeps only itspersist="server"fields between page POSTs (#4174), and a released view refuses newwait_for_eventwaiters through child disposal. Removed internals:LiveView._get_private_state()/_restore_private_state(),djust._lazy_containers.save_http_lazy,djust._child_async.dispatch_legacy_child_work,WaiterMixin._close_waiters()and theRustLiveView.lazy_registration_allowed()binding. Session entries a deployed 1.3 / 2.0 pre-release already wrote for lazy children (liveview_<path>__lazy__<id>) stay in the session untildjust clear --allremoves them. - The
reauthturn-middleware built-in and the legacy arm of every turn are removed (#4201).reauthre-checked only legacy-exposure views, underLIVEVIEW_CONFIG["reauth_on_event"]; every turn of an explicit view is authorized against the session the server stores, so the chain is nowerror_boundary, thenLIVEVIEW_MIDDLEWARE. Each turn kind is authorized on that one path: mount and reconnect, event (WebSocket, SSE, the HTTP fallback and the HTTP API), URL change, server push, tick,db_notify, background start and result, and a deferred event released from a hidden activity. Over WebSocket, the frames the server sends without running a handler are authorized too: a recovery render (request_html) and apush_event_to_viewframe each time, and a presence frame at most once every 5 seconds per connection. A refused turn sendspermission_deniedand closes the socket with 4403. SSE has no presence, client-push or recovery-render frames. - The attribute walk and its exporters are deleted (#4202).
get_context_data()builds only the explicit context (declaredstate()fields, providers,get_render_only_context()and what an override adds);get_state()returns onlyclient=Truefields; the debug panel, the observabilityview_assignsendpoint and thefull_html_updatesignal show the bounded explicit projection; captured SQL parameters are redacted whenever the capture has an owning view. The JIT stays: explicit renders use it (#4069). Removed internals:djust.mixins.context.legacy_unsaved_keys/legacy_render_only_keys, the_djust_render_only_context_keyshooks,LiveView._is_serializable()and the legacy debug-panel walker. - Feature mixins keep only their explicit-exposure behaviour (#4203). Forms, formsets, presence, tutorials, components, data tables, automatic state, context providers, saved server state, exception diagnostics, the service worker, the HTTP fallback and hot view replacement lose the branches that served
exposure_policy = "legacy".FormMixinno longer looks a model up from a storedmodel_pk, presence no longer addsname/user_idto the metadata you pass, anddjust.testing.persisted_state()no longer has a legacy error case. - System checks for the legacy exposure policy are retired (#4204).
djust.V026is retired (every view is explicit, so a class-level plain component is refused when the class is created), andV006,V008,V027,V029,V035,C034,C035andT027no longer read the exposure policy. Remove the retired IDs fromsuppress_checksandSILENCED_SYSTEM_CHECKS. - The legacy event-parameter path is gone, server and client (#4205). Strict is the only binding:
validation.pycoercion, near-miss warnings, legacy type-error hints and the policy resolvers are deleted, and system checksdjust.T028,djust.V033anddjust.C022are retired (strict findings aredjust.T020,T021andV016). The browser no longer collectsdata-*attributes, sends_targetor falls back to legacy collection for a binding with no contract;window.djust.extractTypedParamsis removed (usedj-value-*). Shippedclient.min.js.gz89473 → 88719 bytes (-754), unminifiedclient.js292174 → 289955 bytes gzipped. - The 1.x compatibility shims are removed (#4207).
LiveViewConsumer.handle_eventandhandle_url_changeare deleted andhandle_mountbecomes the private_mount_page;PushEventMixin._flush_pending_push_events(useflush_push_events), the deprecated_drain_announcements/_drain_focusdocs block, thedjust startprojectcommand (usedjust new <name>, whichdjust startprojectnow names and exits 2),djust_theming/css/base.css(an@importofscaffold.css: linkscaffold.css), thedjust:client-commandlistener and the unprefixed-cookie fallback and cleanup in the theming manager andtheme.js(withcookie_namespaceset only<ns>_djust_theme*cookies are read), the Rustcall_block_handler,call_assign_handlerandtry_text_only_vdom_updateshims, and the back-compat re-exports indjust.theming.manager,.presetsand.theme_packs(DEFAULT_CONFIG,ColorScale,ThemeTokens, the*_THEMEconstants, the style types). Each removed Python name raises anImportErrorthat names where to import it from. - The client discards drafts saved in an older format (#4207). A saved draft without the current format number is discarded and removed from storage instead of being partly restored. The compatibility for a reply without a
refand forasync_pendingwithout anasync_batchstays: embedded-child frames and the PythonLiveViewConsumeractivity-drain path still send them. Shippedclient.min.js.gz88719 → 88667 bytes, unminifiedclient.js289955 → 289889 bytes gzipped. - examples/test_textarea_component.py and examples/textarea_benchmark.py are removed (#4243). Both imported a
_RUST_AVAILABLEflag that no longer exists; their functional assertions now live inpython/djust/tests/test_textarea_component_4243.py. - The component templates badge.html, avatar.html, progress.html and pagination.html under djust_components/ are removed (#4331): the tags are drawn by native handlers on both engines, so a project template of the same name no longer overrides them (migration entry 355). The empty, unreferenced accordion.html, card.html, dropdown.html, modal.html, tabs.html and tooltip.html in the same directory are removed too.
Deprecated
- Six component argument aliases are deprecated to 3.0 (#4207).
{% slider %}/{% currency_input %}minandmax(usemin_val/max_val),{% date_picker range=... %}(is_range),{% split_button open=... %}(is_open),{% dj_button variant="danger" %}(variant="destructive") and dict items forDropdown/Tabs(DropdownItem/TabItem) still work and now raise oneDeprecationWarningper process; removal is no earlier than3.0.0.