Release Notes — v0.2.18 (July 17, 2026)
1. TomSelect M2M Widgets Not Initializing in Setup Templates
Status: Uncommitted
Setup templates (setups/partials/) were missing initTomSelects() calls, causing ManyToMany field widgets to render as plain <select multiple> dropdowns instead of the searchable tag-based TomSelect UI.
Problem
The backend UiMixin.get_form_class() correctly attaches data-tomselect="true" and autocomplete data attributes to M2M fields in the form's widget attrs (enezaframework/views/mixins.py:389-449). However, the custom MultiSelectWidget JS class (tomselect-init.js) relies on initTomSelects() being called to scan for select[data-tomselect="true"] elements and instantiate widgets on them.
The core templates (core/partials/) all had these initialization calls, but the setup templates did not. The inline create/detail partials in setups had initTomSelects(target) in their form submission handlers (for HTMX swaps), but the main form templates and readonly variants had no initialization at all.
Fix
Main Form Templates (setup_create.html, setup_details.html)
Three additions matching the patterns in core/partials/create_partial.html and core/partials/detail_partial.html:
-
TomSelect value sync before form submission — Added sync loop before
FormDataconstruction insubmit_main_object_form_form()to ensure selected items are included in the POST data:javascript form.querySelectorAll('select[data-tomselect="true"]').forEach(function(select) { if (select._msWidget) { select._msWidget.syncToSelect(); } }); -
Re-initialization after HTMX swap — Added
initTomSelects(targetElement)in the.then()success callback afterinnerHTMLassignment:javascript if (typeof initTomSelects === 'function') { initTomSelects(targetElement); } -
Initial page load — Added at end of
<script>block:javascript if (typeof initTomSelects === 'function') { initTomSelects(); }
Readonly Templates (setup_readonly_create.html, setup_readonly_details.html)
Added initTomSelects() script block for initial page load initialization. These forms use hx-post directly (no custom submit function), so no sync is needed — HTMX serializes the form natively and TomSelect widgets sync on every item selection.
Inline Templates (inline_create_partial.html, inline_details_partial.html, inline_detail_partial_readonly.html)
- Create/Detail inlines — Already called
initTomSelects(target)in their form submit handlers. AddedinitTomSelects()on initial page load at end of script block. - Readonly inline detail — Added
initTomSelects()call at end of script block.
Files Changed
| File | Changes |
|---|---|
enezaframework/templates/setups/partials/setup_create.html |
+13 lines: sync loop, init after swap, init on load |
enezaframework/templates/setups/partials/setup_details.html |
+13 lines: sync loop, init after swap, init on load |
enezaframework/templates/setups/partials/setup_readonly_create.html |
+7 lines: script block with init on load |
enezaframework/templates/setups/partials/setup_readonly_details.html |
+7 lines: script block with init on load |
enezaframework/templates/setups/partials/inline_create_partial.html |
+4 lines: init on load |
enezaframework/templates/setups/partials/inline_details_partial.html |
+4 lines: init on load |
enezaframework/templates/setups/partials/inline_detail_partial_readonly.html |
+4 lines: init on load |
Backward Compatibility
- No backend changes. The
data-tomselect="true"attributes were already being generated byUiMixin.get_form_class(). - No migration or model changes required.
- Templates without M2M fields are unaffected —
initTomSelects()safely no-ops when nodata-tomselectselects exist in the DOM.
2. Version Bump
setup.py: Version bumped from0.2.17→0.2.18.RELEASE_NOTE/CHANGELOG.md: Added 0.2.18 entry.
Summary
| Area | Description | Files |
|---|---|---|
| Setup Templates | Added TomSelect M2M widget initialization, sync, and re-init to 7 setup template partials | 7 |
| Versioning | Version bumped to 0.2.18, CHANGELOG updated | 2 |
Total: 9 files changed (7 templates, setup.py, CHANGELOG.md).
Note: All changes are uncommitted and untested. The user is solely responsible for testing and validating all outputs before committing or deploying.