djust 1.3.3

Stable Security Released
Install
pip install djust==1.3.3

Part of djust 1.3 — read the 1.3 release notes.

Added

  • {% dj_radio_group %}, and live_input radios are a radiogroup (#3961). A lone {% dj_radio %} is announced with no group name, required state or description, and {% live_input "radio" %} rendered loose <label><input> rows. {% dj_radio_group name="plan" label="Plan" options=plans value=plan event="set_plan" required=True helper="..." error="..." %} renders a <fieldset role="radiogroup"> named by its <legend>, one input per option with its own <label for> (ids <group>_<index>), aria-required, and the help and error as the group's aria-describedby / aria-invalid; field=form.plan fills it from a BoundField. Both engines render the Python tag's markup (it is on the object-argument bridge). live_input radios are wrapped in <div role="radiogroup"> (legend= makes it a <fieldset> with a <legend>), and the group-level aria_label / aria_labelledby / aria_describedby / aria_invalid / aria_required go on the group instead of on every radio. Cases in TestRadioGroup and TestLiveInputRadio of python/djust/tests/test_component_aria_v1_3_0_19.py.
  • WizardMixin can resume stored progress (#3965). mount() always started at step 0 with nothing answered, so a reload or a reconnect that mounted the view again lost the person's place. get_wizard_initial() ({step_name: {field: value}}) and get_wizard_step() (an index or a step name) are now called by mount(); the defaults return {} and 0, so a wizard that overrides neither behaves as before. Values are stored as the text the browser would submit (wizard state is JSON), steps and fields the wizard does not declare are ignored with a warning, a step that does not exist starts at the first one, and every step before the one resumed counts as completed (so go_to_step can return to it; next_step and submit_wizard still validate). on_step_saved(step_name, data) runs when next_step has validated a step, just before the wizard moves on, so "save on every step" does not need an overridden handler; a hook that raises leaves the person on the step. Not added: wizard_step_param (URL-synced step) and a hook for prev_step, whose step is not validated. Regression tests in python/djust/tests/test_wizard_submitted_step_3964_3965.py.
  • ModelFormMixin: cheaper live validation and a record selected from the page, without weakening ADR-017 for writes (#3967). Two opt-ins, both off by default. object_recheck = "writes": an event that cannot write reuses the record authorized earlier on the same connection instead of looking it up and authorizing it again, so dj-input="validate_field" no longer costs a query per keystroke. Only the framework's own validate_field and the handlers named in object_read_only_events qualify; every other event (submit_form, reset_form, every handler of the app's, including ones that write without saying so) is a write and gets the full check, under every setting. The record is reused only while it is unchanged since it was authorized, the route and lookup are the same and the user is the same; listed handlers are matched by function, so a subclass that redefines validate_field or a listed handler gets the full check for it. The record's field values are compared deeply (an in-place edit of a JSONField counts), and input restored from a saved session is bound to the record it was typed for (form_object_key), never to another one. get_object_lookup() (keys pk_url_kwarg / slug_url_kwarg, default the route's kwargs) selects the record from view state such as a ?open=<id> parameter kept in handle_params; the record is then authorized after mount() and handle_params(), with the same queryset scoping and has_object_permission(). With object_optional = True, "nothing selected" is object = None and no form rather than a denial; a selected record that is missing, filtered out or forbidden (or a key that is not valid, ?open=abc) is still the same denial, and switching the selection starts the form from the new record's own values. Differs from the issue: read-only is declared by an allowlist (an unmarked handler is a write) rather than @event_handler(mutates=True), because the latter would turn an app's forgotten marker into a skipped authorization. Regression tests in python/djust/tests/test_model_form_object_recheck_3967.py.
  • Theme classes for the form adapters, and accessible choice groups. The classes as_live_field / as_live / {% live_field %} use are set by slot (input, textarea, select, label, help, error, wrapper, legend, radio_group, radio_option, radio_input, radio_label, ...; the list is djust.frameworks.FORM_CLASS_SLOTS) in LIVEVIEW_CONFIG["form_classes"], or in css_classes on an adapter subclass, without copying adapter code or a framework's whole class map. css_classes wins over form_classes, which wins over the framework's map; an unset slot keeps the framework's class. A RadioSelect renders as <fieldset role="radiogroup"> named by its <legend>, with aria-required, the group's aria-describedby / aria-invalid, and one <input type="radio" dj-change="validate_field"> per choice with its own <label for> and an id <auto_id>_<index>; the hook classes dj-radio-group / dj-radio-option, plus dj-radio-group--segmented from group_variant="segmented", let a theme draw segmented buttons. A CheckboxSelectMultiple renders as a <fieldset class="dj-checkbox-group"> of checkboxes instead of a single <select>. A built-in adapter now reads its own framework's classes (framework="tailwind" gets Tailwind's even when css_framework is bootstrap5). Documented in docs/ai/forms.md and the CSS frameworks guide.

Changed

  • A repeated form-field name is now a list for dj-submit handlers, and dj-change / dj-input / dj-blur / dj-focus on a group of same-named checkboxes or a <select multiple> now send a list as value, under the legacy policy as well (#3959). Migration, in the order it will bite:
    • A dj-change handler on a group of same-named checkboxes (for example a per-row toggle, <input type="checkbox" name="done" dj-change="toggle_todo"> on every row, or {% live_input "checkbox" %} repeated with the same handler and no name=) now receives the list of checked values of the group (the form, or the whole page when the boxes are in no form), not "is this box ticked". An untyped toggle(self, value=False, **kw) sees a list, which is truthy while ANY box of the group is ticked, so unticking one of several ticked rows reads as still ticked; a handler declaring value: bool is rejected with a type error. Read value as a list, or give each box its own name to keep the per-box boolean. A lone checkbox is unchanged.
    • A dj-submit handler that read a repeated name as one string, for example the hidden-input-plus-checkbox idiom (<input type="hidden" name="x" value="0"> then <input type="checkbox" name="x" value="1">, which used to see the last value), now receives ["0", "1"] when the box is ticked and "0" when it is not, so a handler declaring x: str fails only while the box is ticked. Take the last element, or give the inputs different names.
    • This is the owner's decision for #3959 (FormMixin.validate_field must be able to validate a MultipleChoiceField); there is no opt-out attribute. See "Fields with several values" in docs/website/guides/forms.md. Pinned by tests/js/form_events_review_3976.test.js and python/djust/tests/test_form_multi_value_review_3976.py.

Fixed

  • dj-submit: the pressed submit button is lost under strict event parameters (#3958). _target, its only channel, is never generated under the strict policy (ADR-036 decision Q2), and the button's own name=value was never a field. Under strict the pressed button's name=value is now a generated form field, as on a native post, and follows Q1 like every other generated value: it is sent only to a handler that declares that parameter or has a ** catch-all, so naming a button cannot add a parameter to a closed handler (ADR-036 addendum, 2026-11-11). An unnamed or disabled button, a submit with no submitter, a name that is not an ASCII identifier starting with a letter (save-draft, _x), and a name the transports read as protocol (event and params, which the HTTP fallback reads as its {event, params} envelope and which re-routed the call, component_id, view_id, csrfmiddlewaretoken, constructor, prototype) send nothing, on the WebSocket and the HTTP fallback alike. Legacy handlers are unchanged (_target stays the channel and no field is added, since a legacy closed signature rejects an unexpected parameter). Covered by tests/js/submit_submitter_3958.test.js and tests/js/form_events_review_3976.test.js.
  • Multi-value form fields lose values: dj-submit kept only the last FormData entry, dj-change on a checkbox sent its checked state (#3959). A checkbox group (two or more same-named checkboxes in one form), a <select multiple> and any repeated name now reach a dj-submit handler as a list in document order, the way Django's QueryDict.getlist sees a native POST; a group or <select multiple> is a list even with one value selected or none ([]), so unticking everything replaces the server's earlier list instead of leaving it stale. dj-change (and dj-input / dj-blur / dj-focus) on one box of a group sends the list of checked values, and on a <select multiple> every selected option (it sent the box's boolean, and the first option), so FormMixin.validate_field validates a MultipleChoiceField. Reconnect form recovery replays a group as one list-valued dj-change. A lone checkbox is unchanged. The {% dj_form %} renderer now ticks / selects each member of a list value for a CheckboxSelectMultiple / SelectMultiple (it ticked nothing, so a re-render un-ticked the user's choice). Under the strict policy declare list[str] (or Any). Browser coverage in tests/js/form_multi_value_3959.test.js, tests/js/form_recovery_multi_value_3959.test.js and tests/js/form_events_review_3976.test.js; the server half is pinned in python/djust/tests/test_form_multi_value_3959.py and, for the renderer in both engines, python/djust/tests/test_form_multi_value_review_3976.py.
  • dj-disable-with restored a button's old text over the text the server had just rendered (#3963). The restore pass ran after the response's patches, so a button the same response re-labelled in place (a "Next" button becoming "Finish") showed its pre-submit text again, and a button the response rendered disabled was re-enabled. The restore now runs before the patches, so they apply to the server's baseline and have the last word, and it re-enables only a button the submit itself disabled (a sibling submit button that was already disabled stays disabled). Covered by tests/js/disable_with_server_text_3963.test.js and tests/js/form_events_review_3976.test.js.
  • WizardMixin.next_step ignored the step form a dj-submit posted, and validate_field did not validate (#3964). A step rendered as <form dj-submit="next_step"> was validated against wizard_step_data only, so unless every field had also sent a validate_field event the step failed as empty (or passed on stale values). next_step now merges the fields the CURRENT step's form declares (and nothing else: not the CSRF token, not another step's fields) into the step's data before validating, through the same max_form_fields / max_form_data_size / max_form_members bounds as every other client-named key (a post past them is refused whole); submit_wizard does the same for the last step. validate_field now also cleans that one field (field.clean() and the form's clean_<name>(), as FormMixin.validate_field does) and puts the failure in wizard_step_errors[step][field] while the person types. The wizard guide now says that wizard_rendered_fields = () skips the per-render field_html work for a template that writes its own inputs. Regression tests in python/djust/tests/test_wizard_submitted_step_3964_3965.py.
  • FormSetHelpersMixin.add_row / remove_row (and the module-level helpers) dropped instance, queryset and every other formset argument (#3966). They rebuilt the formset as formset_cls(data, prefix=prefix): an inline formset lost its parent after one "Add row" (saving then created items with no order) and a model formset fell back to the model's whole table, where a posted row id outside the view's queryset would be saved. add_row() / remove_row() now take **formset_kwargs and pass them through, and the mixin gets get_formset_kwargs(name) (default {}; data and prefix are refused) which both handlers call and mount() can use to build the same formset. When the bound data has no management form yet (a view that starts with _formset_data = {}) and formset kwargs are given, the formset those kwargs build is the starting point, so the rows it already shows are kept; passing the kwargs alone would still have shown only the new row. With no formset kwargs nothing changes. Regression tests in python/djust/tests/test_formset_kwargs_3966.py.
  • Flash messages are one live region each, not role="alert" inside role="status" (#3968). {% dj_flash %} rendered its container as role="status" aria-live="polite" and the client appended each message as role="alert", nesting live regions, which leaves the announcement (twice, or at the wrong urgency) to each screen reader. The container (both renderers) no longer has a role or aria-live; showFlash gives info, success and any other level role="status" and warning / error role="alert". If you wrote your own #dj-flash-container, drop its live role too. Not verified with a screen reader. Cases in the flash live regions (#3968) block of tests/js/flash.test.js and TestContainerIsNotALiveRegion of python/tests/test_flash_tag_handler.py.
  • {% progress %} draws under a strict CSP and exposes a progress value (#3969). The fill was style="width:N%", which a style-src without 'unsafe-inline' refuses, so the bar rendered empty. The width is now a class, dj-progress-w-0 to dj-progress-w-100 (in components.css), on the Django tag, the native handler and djust.components.Progress (which rounds to a whole percent; aria-valuenow keeps the exact value). The native handler's track also gains role="progressbar", aria-valuenow / -min / -max and an aria-label, as the Python tag's has (named by its label= when there is one; no renderer invents a name for an unlabelled bar). djust.components.ui.Progress (the Bootstrap / Tailwind one) is unchanged. Verified in a browser under style-src 'self'. Cases in TestProgress of python/djust/tests/test_component_aria_v1_3_0_19.py.
  • {% stepper %} steps are keyboard-operable buttons in an ordered list (#3970). Under the Rust engine each step was a <div dj-click>: not focusable, no role, the current step unmarked, "completed" only a CSS class. All three renderers (the Django tag, the native handler and Stepper) now render <ol class="stepper"> of <li class="stepper-step">, each holding a <button type="button">; the current step is aria-current="step" and a completed step that is not current adds a visually hidden "(completed)". If you restyle .stepper-step as a button, move those rules to .stepper-step-button (the <li> is now the flex item). Cases in TestStepper of python/djust/tests/test_component_aria_v1_3_0_19.py.
  • {% status_indicator %} is no longer a live region on every instance (#3971). It rendered role="status", so a page with one indicator per table row had dozens of polite live regions, each announced when its text changed. A label that is part of the page is not a status message (WCAG 4.1.3): the indicator is now a plain <span>, under both engines. live=True (also on StatusIndicator) opts the one indicator that updates in place back in. Cases in TestStatusIndicator of python/djust/tests/test_component_aria_v1_3_0_19.py.
  • djust.Y005 no longer flags an <svg> or role="img" inside an aria-hidden="true" ancestor (#3973). aria-hidden="true" removes the whole subtree from the accessibility tree, so a graphic inside a hidden wrapper needs no name; the check only looked at the element's own attributes. An unhidden unnamed <svg>, aria-hidden="false" on the wrapper, a sibling after the wrapper closes, a self-closing or void "wrapper" and a wrapper that never closes are still reported. Cases in TestY005AriaHiddenAncestor3973 of python/djust/tests/test_accessibility_checks.py.
  • Form adapter fields link their help text and errors to the control. Every adapter gives the help text the id <auto_id>-help and the errors <auto_id>-error (auto_id is id_<name> unless passed), lists the rendered ones in the control's aria-describedby (after any the widget sets), marks a field with errors aria-invalid="true", and hides the required * from assistive technology (the control is already required). An optional ChoiceField whose choices already include a blank option no longer gets a second empty <option>, grouped choices render as <optgroup>, a BooleanField no longer renders two labels, and radio ids no longer contain the choice value (a value with a space made an invalid id). Pinned in python/tests/test_form_adapter_a11y.py.
  • toggle_group and rating no longer submit the form they sit in, and can post their value. Their buttons had no type, so inside a <form> each click was a submit. Every renderer (the template tag, the Rust engine's inline handler and the ToggleGroup / Rating component classes) now writes <button type="button">. {% toggle_group ... form_field=True %} adds hidden inputs that post the selected value(s) under name, and {% rating ... name="score" %} posts the current rating; both are opt-in, so a submit handler that does not take the field is unchanged. {% dj_radio %} builds its id from <name>_<value> with characters other than letters, digits, _ and - replaced by - (a value with a space made an invalid id), and takes an explicit id=. Pinned in python/djust/tests/test_component_form_buttons.py.

Security

  • toggle_group no longer lets a marked-safe value out of an attribute. name (data-name), event (dj-click), size (the class suffix) and mode (data-mode) were written with conditional_escape, which keeps a value marked safe, so a mark_safe string closed the attribute and injected markup; the native handler also did this for each option's data-value, and for all five when a typed argument or a direct call handed it the real value. All five now go through attr_text, in the Django tag and the native handler. The change also restores the safe-markup audit baseline that main failed (ToggleGroupHandler.render was unaudited after #3962); pinned in python/djust/tests/test_component_form_buttons.py.

  • rustix 1.1.4 to 1.1.6 (RUSTSEC-2026-0486, #3985). An unsound-class advisory (xattr functions marking unwritten bytes as initialized for a zero-length buffer) that the repository's audit policy denies. rustix is reached only as a dev-dependency (tempfile via proptest in djust_vdom and djust_templates), so it is not in the shipped extension. bincode 2.0.1 (RUSTSEC-2025-0141, unmaintained) stays an allowed warning under .cargo/audit.toml.

All releases · Atom feed