Django ORM, everywhere — generate TypeScript types from Django models
Project description
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)._conflictsModel.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_rangeoffset_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.
- When
DJAZZKIT_WS_REQUIRE_ORIGIN(default:False)- When
True, sockets without anOriginheader are rejected.
- When
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_versioninsync_start(via@djazzkit/coreSyncClientOptions.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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49c99d97008df2e1a60c6de00f741245b4c62831fb70480174e445cf9a58cf67
|
|
| MD5 |
2d757f7033d3a549922ea7f0757b0a32
|
|
| BLAKE2b-256 |
d109112aa4d179ff53284693e9a3b2ccdc54c2798bede0a3f03da2669114dbbc
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48450b43e2967e44921994eee5fcee794cd62955a18476e5bc63fc2ad289aea0
|
|
| MD5 |
eaafe457d44563f2dc372fcffc920928
|
|
| BLAKE2b-256 |
31f9051aeebca8a475e2c22658c605dfd6ff2b8de5bd4aba15a2e75602891d56
|