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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djazzkit-0.0.1.tar.gz (71.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

djazzkit-0.0.1-py3-none-any.whl (52.1 kB view details)

Uploaded Python 3

File details

Details for the file djazzkit-0.0.1.tar.gz.

File metadata

  • Download URL: djazzkit-0.0.1.tar.gz
  • Upload date:
  • Size: 71.3 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for djazzkit-0.0.1.tar.gz
Algorithm Hash digest
SHA256 49c99d97008df2e1a60c6de00f741245b4c62831fb70480174e445cf9a58cf67
MD5 2d757f7033d3a549922ea7f0757b0a32
BLAKE2b-256 d109112aa4d179ff53284693e9a3b2ccdc54c2798bede0a3f03da2669114dbbc

See more details on using hashes here.

File details

Details for the file djazzkit-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: djazzkit-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 52.1 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for djazzkit-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 48450b43e2967e44921994eee5fcee794cd62955a18476e5bc63fc2ad289aea0
MD5 eaafe457d44563f2dc372fcffc920928
BLAKE2b-256 31f9051aeebca8a475e2c22658c605dfd6ff2b8de5bd4aba15a2e75602891d56

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page