Django Workflow Kit
A modern, extensible workflow and approval engine for Django applications.
Django developers can add a sophisticated workflow system to an existing Django project without building the engine themselves. Add state machines, approval workflows, audit trails and timelines with a small, understandable Python API.
Simple to start. Powerful when needed. Django-native.
The problem
Most business applications eventually need to model processes:
- Create an invoice, submit it for approval, get manager and finance sign-off.
- Track a leave request from draft through approval.
- Route a document through review, verification and publication.
Hand-rolled workflow code quickly becomes a tangle of scattered if/else
checks, duplicated state guards, and unverifiable audit stories. Django
Workflow Kit moves that complexity inside a well-tested engine while keeping a
clean public API.
Features
- Declarative workflow, state and transition definitions
- State machines with stable identifiers and human-readable labels
- Atomic, concurrency-safe transitions
- Django-native permission checks (users, groups, model permissions)
- Sequential, parallel, any-of and all-of approvals
- Workflow versioning: immutable numbered definitions with version-bound executions that never silently change definition mid-flight
- Append-only audit trail and derived timelines
- Comments and file attachments on executions (recorded in the timeline and observable as domain events; files stored via Django's storage abstraction)
- Extensible conditions evaluated against a typed context — never
eval - Pluggable notification providers; email and signed webhooks are included, with Slack, Teams or other channels added as custom providers
- Developer experience: declarative workflow definitions, static validation
with structured reports, introspection, dry-run simulation, action
diagnostics (
explain/why-not), DOT/Mermaid graphs, apython -m workflow_kit.clicommand line interface, and testing helpers - Observability and analytics: read-only aggregate metrics and duration statistics over executions, approvals, SLA and versions, per-state turnaround analysis with bottleneck detection, SLA compliance and escalation analytics, a dependency-free Prometheus text exposition, structured event logging with correlation ids, DRF analytics endpoints (permission-gated) and an admin analytics summary page
- Workflow Dashboard: a server-rendered Django app (no frontend framework) with an overview, My Work queue, searchable/filterable/paginated executions, execution detail (state, version, timeline, audit, approvals, comments, attachments) and analytics screens — all behind the same permissions as the REST API
- Production hardening: deterministic concurrency and idempotency for version creation, query-count regression tests, justified indexes, a security audit of the authorization boundary and attachment policies
- Optional Django REST Framework integration
- Minimal dependencies: Python and Django only at its core
Roadmap
The project is developed in phases. See CHANGELOG.md and Phase Overview.
Architecture
Django Application
│
▼
Workflow Definition
│
▼
Workflow Engine
├── States · Transitions · Conditions · Permissions
├── Approvals · Audit · Timeline · Notifications
▼
Django ORM
The engine is independent of any specific business model and works with arbitrary Django models.
Quickstart
pip install django-workflow-kit
Add to INSTALLED_APPS, then define a workflow:
from workflow_kit import Workflow
invoice_workflow = Workflow(
name="invoice_approval",
initial="draft",
states=["draft", "manager_review", "finance_review", "approved", "rejected"],
transitions=[
("submit", "draft", "manager_review"),
("approve", "manager_review", "finance_review"),
("approve", "finance_review", "approved"),
("reject", "*", "rejected"),
],
)
Start an execution and perform transitions:
execution = invoice_workflow.start(invoice, user=user)
execution.transition("submit", user=user)
execution.approve(user)
execution.reject(user, reason="Missing quotation")
Documentation
Full documentation lives in docs/:
Testing
pip install -e ".[dev]"
pytest
Contribution
Guidelines in CONTRIBUTING.md.
Security
See SECURITY.md for how to report vulnerabilities.
License
Distributed under the MIT License.
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 django_workflow_kit-1.0.0.tar.gz.
File metadata
- Download URL: django_workflow_kit-1.0.0.tar.gz
- Upload date:
- Size: 173.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed882a6f9fe573f2dca2726093824b427b439cf4c5ed5d3d2d52bcbe788874b5
|
|
| MD5 |
74e640b8d7855ae8aedbf649fdfab060
|
|
| BLAKE2b-256 |
76468189e64e607c9872dc91cdf4a1df53fca8168ed5506b839e9b5d8f2c9bc9
|
File details
Details for the file django_workflow_kit-1.0.0-py3-none-any.whl.
File metadata
- Download URL: django_workflow_kit-1.0.0-py3-none-any.whl
- Upload date:
- Size: 151.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7143af63504a9da73db0272a358a3440a7fee25ec521370659cf301aad8742cd
|
|
| MD5 |
08b26ae2b407d7b63db309745daf8328
|
|
| BLAKE2b-256 |
da46d9c2c5cff64405ecc272bdbcc9323fe198946cfb0167922b408ae5431242
|