Home Features Docs Blog Security Examples FAQ
Releases - Part 2 of 4

djust 0.2.0: Template Operators, VDOM Fixes, and a Cleaner Event Syntax

djust Team | | 4 min read
djust 0.2.0 release announcement

Overview

djust 0.2.0 is the first stable release following the 0.1.x series. It introduces new template operators, fixes several critical VDOM rendering bugs, and completes a breaking rename of the event binding syntax. If you're upgrading from 0.1.x, read the breaking changes section carefully.

New Features

Template and / or / in Operators

Template conditions now support boolean and membership operators with correct precedence and chaining:

{% if user.is_active and user.is_verified %}
  <span class="badge badge-success">Verified</span>
{% endif %}

{% if role in allowed_roles %}
  <button dj-click="admin_action">Admin</button>
{% endif %}

These work anywhere {% if %} is used, including nested conditions.

VDOM Debug Tracing

The debug_vdom Django setting now bridges directly to Rust-level VDOM tracing. Mixed keyed/unkeyed children emit developer warnings to help catch template issues early.

Breaking Changes (from 0.1.x)

These changes were introduced in the 0.2.0 alpha releases and are now finalized:

Event Binding Prefix: @dj-

All event attributes now use the dj- prefix instead of @:

<!-- Before (0.1.x) -->
<button @click="increment">+1</button>
<input @input="search">

<!-- After (0.2.0) -->
<button dj-click="increment">+1</button>
<input dj-input="search">

This applies to all events: dj-click, dj-input, dj-submit, dj-change, dj-keydown, dj-keyup, dj-focus, dj-blur, and dj-mouseover.

Data Attribute Renames

  • data-liveview-rootdata-djust-root
  • data-liveview-iddata-djust-id

WebSocket Message Types

  • connectedconnect
  • mountedmount

Bug Fixes

Pre-rendered DOM Whitespace Preservation

WebSocket mount no longer replaces innerHTML when content was already pre-rendered via HTTP GET. Instead, data-dj-id attributes are stamped onto existing DOM elements. This fixes broken whitespace in code blocks and syntax-highlighted content.

VDOM Keyed Diffing

Unkeyed children in keyed diffing contexts are now matched by relative position, eliminating spurious insert+remove patch pairs when keyed children reorder. This significantly reduces DOM churn in lists.

Event Handler Attributes Preserved

dj-* event handler attributes are no longer stripped during VDOM patching. Previously, event bindings could disappear after a re-render.

Model List Serialization

Lists of Django Model instances are now properly serialized on initial GET requests. Previously, passing a queryset result to a template could fail silently.

Mount URL Path

WebSocket mount requests now use the actual page URL instead of a hardcoded path, fixing routing issues in multi-page applications.

Dependency Upgrades

  • html5ever 0.27 → 0.36
  • markup5ever_rcdom 0.3 → 0.36
  • vitest 2.x → 4.x

Upgrading

pip install --upgrade djust==0.2.0

Migration steps:

  1. Find and replace @click, @input, etc. with dj-click, dj-input, etc. in all templates
  2. Replace data-liveview-root with data-djust-root and data-liveview-id with data-djust-id
  3. If you handle WebSocket messages directly, update connectedconnect and mountedmount
  4. Run your test suite to catch any remaining references

A project-wide search for @click, @input, data-liveview, and "connected" should surface everything that needs updating.

What's Next

The next release will focus on WebSocket event security hardening, including rate limiting, message size limits, and an event allowlist mechanism. Follow the project on GitHub for updates.

Share this post

Related Posts