Fixed
- FormMixin: serialization, event handling, and ModelForm support — Fixed 6 issues blocking production use of
FormMixinwithModelFormover WebSocket: added@event_handlertosubmit_form()andvalidate_field(); renamedform_instanceto private_form_instancewith backward-compatible property; storemodel_pk/model_labelas public attributes for re-hydration after WS session restore; syncform_datafrom saved instance afterform_valid(); use FK PK instead of related object; auto-populateform_choiceswith serializable tuples. (#545) dj-hookelements not re-initialized afterhtml_updateorhtml_recovery— When VDOM patches failed and djust fell back to full HTML replacement,updateHooks()was never called, leaving hook elements stale (charts showing old data, canvases empty). AddedupdateHooks()to all DOM replacement paths:html_update,html_recovery, TurboNav reinit, embedded view update, lazy hydration, and streaming updates. (#548)__version__not updated bymake version—make versiononly updatedpyproject.tomlandCargo.tomlbut not the hardcoded__version__in__init__.pyfiles.djust.__version__now stays in sync with the package version. (#547)
Changed
- Extract
reinitAfterDOMUpdate()to DRY up post-DOM-update calls — The repeated pattern ofinitReactCounters()+initTodoItems()+bindLiveViewEvents()+updateHooks()across 10+ call sites is now a single function. New DOM replacement paths only need one call. (#549) - Extract
addEventContext()to consolidate component/embedded view ID extraction — The 8-linegetComponentId/getEmbeddedViewIdpattern appeared 4 times in event binding; now a single helper. (#551) - Extract
isWSConnected()to replace WebSocket state guard chains — TheliveViewWS && liveViewWS.ws && liveViewWS.ws.readyState === WebSocket.OPENpattern appeared across 4 files; now a single predicate. (#552) - Extract
clearOptimisticPending()to consolidate CSS class cleanup — ThequerySelectorAll('.optimistic-pending')removal loop appeared 4 times across 2 files; now a single function. (#553) - Standardize
DJUST_CONFIGaccess viaget_djust_config()— Replaced 10+ inlinegetattr(settings, "DJUST_CONFIG", {})try/except blocks across tenants, PWA, and storage modules with a singleget_djust_config()helper inconfig.py. (#554) - Extract generic
BackendRegistryclass — The duplicated lazy-init / set / reset pattern instate_backends/registry.pyandbackends/registry.pynow delegates to a sharedBackendRegistryclass inutils.py. (#555) - Extract
is_model_list()helper — The repeatedisinstance(value, list) and value and isinstance(value[0], models.Model)check is now a singleis_model_list()function inutils.py, used inmixins/context.pyandmixins/request.py. (#556)