Skip to main content

djazzkit Django Package

Django adapter for djazzkit sync/query/rpc functionality.

Conflict Resolution v2

Conflict handling is opt-in per model and preserves current LWW behavior by default.

Configure per model

from djazzkit.models import SyncModel
from djazzkit.sync_meta import SyncScope, ConflictMode

class Note(SyncModel):
    # ... fields ...

    class SyncMeta:
        scope = SyncScope.USER
        owner_field = "author"
        conflict_mode = ConflictMode.REVISION_TREE

Optional server-side resolver hook

def note_conflict_resolver(ctx: dict) -> dict | None:
    # Return resolved data to auto-resolve, or None to keep conflict unresolved.
    return None

class Note(SyncModel):
    class SyncMeta:
        scope = SyncScope.USER
        owner_field = "author"
        conflict_mode = ConflictMode.REVISION_TREE
        conflict_resolver = staticmethod(note_conflict_resolver)

Surface unresolved conflicts

conflicted_notes = Note.objects.with_conflicts()

TypeScript side

Generated model classes provide:

  • Model.getConflicts(instanceId)
  • Model.resolveConflict(instanceId, resolvedData)
  • Model.conflict(row)._conflicts
  • Model.conflict(row).resolveConflict(...)

Rows continue to serve the deterministic winner by default while losing revisions remain retained until explicitly resolved.

Remote query safety bounds

Remote query AST validation enforces server-side maxima for pagination inputs:

  • DJAZZKIT_QUERY_MAX_LIMIT (default: 1000)
  • DJAZZKIT_QUERY_MAX_OFFSET (default: 10000)

Requests above these bounds are rejected with explicit validation codes:

  • limit_out_of_range
  • offset_out_of_range

Example settings:

DJAZZKIT_QUERY_MAX_LIMIT = 500
DJAZZKIT_QUERY_MAX_OFFSET = 5000

WebSocket auth and origin hardening

WebSocket auth/origin behavior is configurable:

  • DJAZZKIT_WS_ALLOW_ANONYMOUS_FALLBACK (default: True)
    • When False, missing/invalid auth rejects the socket instead of downgrading to anonymous.
  • DJAZZKIT_WS_REQUIRE_ORIGIN (default: False)
    • When True, sockets without an Origin header are rejected.

Recommended production settings:

DJAZZKIT_WS_ALLOW_ANONYMOUS_FALLBACK = False
DJAZZKIT_WS_REQUIRE_ORIGIN = True

For trusted non-browser clients that cannot send Origin, keep DJAZZKIT_WS_REQUIRE_ORIGIN = False and enforce transport-level trust.

Schema mismatch signaling

djazzkit now signals schema incompatibility over the sync websocket:

  • Client sends schema_version in sync_start (via @djazzkit/core SyncClientOptions.schemaVersion)
  • Server compares it to the current runtime schema hash
  • On mismatch, server responds with:
    • {"type":"schema_mismatch","client_schema_version":"...","server_schema_version":"...","message":"..."}

@djazzkit/core exposes onSchemaMismatch so apps can choose their policy:

  • reset local SQLite and resync
  • run custom migration logic to preserve local data
  • prompt user before taking action

Migration note

If internal djazzkit tables were previously created through --run-syncdb, run:

python manage.py migrate djazzkit --fake-initial

when adopting migration-managed internal tables.

Metadata

Release files for djazzkit 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djazzkit 0.0.1
File Size Uploaded
djazzkit-0.0.1.tar.gz 71.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for djazzkit 0.0.1
File Interpreter ABI Platform
djazzkit-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 123.3 kB

Release files / djazzkit-0.0.1.tar.gz

Download URL djazzkit-0.0.1.tar.gz
Size 71.3 kB
Tags Source
SHA-256 checksum
How to use checksums
49c99d97008df2e1a60c6de00f741245b4c62831fb70480174e445cf9a58cf67
BLAKE2b-256 checksum
How to use checksums
d109112aa4d179ff53284693e9a3b2ccdc54c2798bede0a3f03da2669114dbbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / djazzkit-0.0.1-py3-none-any.whl

Download URL djazzkit-0.0.1-py3-none-any.whl
Size 52.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48450b43e2967e44921994eee5fcee794cd62955a18476e5bc63fc2ad289aea0
BLAKE2b-256 checksum
How to use checksums
31f9051aeebca8a475e2c22658c605dfd6ff2b8de5bd4aba15a2e75602891d56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page