Workflow Type Registry Reference
Developer guide for the Enezaframework workflow engine. Part of the Workflow series.
Table of Contents
Overview
Condensed reference for the workflow type registry. For behavior and examples, see Workflow Type Registry Architecture and Workflow Project Configuration.
WorkflowTypeRegistry API
Defined in enezaworkflowengine/services/workflow_type.py:5.
| Method | Signature | Description |
|---|---|---|
get_allowed_models |
get_allowed_models(workflow_name: Optional[str] = None) -> List[Dict[str, Any]] |
Returns the model config list for the workflow, or _default_models when the name is unknown/absent. |
has_workflow |
has_workflow(workflow_name: str) -> bool |
True if the name is in the merged registry. |
register |
register(workflow_name: str, models: List[Dict[str, Any]]) |
Adds or overwrites a workflow entry at runtime. |
Internal helpers:
| Method | Line | Role |
|---|---|---|
_load_project_registry() |
:137 |
Imports the project config class and returns its registry dict. |
_load_merged_registry() |
:170 |
Merges framework + project, caches in cls._registry. |
_framework_registry |
:36 |
Class-level built-in definitions. |
_default_models |
:104 |
User + Entity fallback. |
Settings
| Setting | Purpose | Required |
|---|---|---|
MY_PROJECT_WORKFLOWS_CONFIG |
Dotted path to the project's WorkflowTypeConfig class. |
No |
MY_PROJECT_WORKFLOWS_NAME |
Dotted path to a custom Workflownames choices class. |
No |
Both are optional; without them the framework defaults apply.
Model Config Schema
python
{
'slug': str, # required, unique per workflow
'label': str, # required
'app_label': str, # required
'model_name': str, # required
'relationships': [ # optional; omit for auto-discovery, [] to disable
{
'field_name': str,
'label': str,
'type': str, # 'fk' | 'm2m'
'related_app': str,
'related_model': str,
},
],
}
Files
| File | Purpose |
|---|---|
enezaworkflowengine/services/workflow_type.py |
WorkflowTypeRegistry implementation. |
enezaworkflowengine/views/mixin.py |
QueryBuilderMixin — reads the registry, generates filters and aggregate options. |
enezaworkflowengine/views/querybuilder.py |
Generic query builder and saved-query views. |
enezaworkflowengine/models/choices.py |
Workflownames and get_getworkflow_names_choices(). |
enezaworkflowengine/models/querybuilder.py |
SavedQuery model with the workflow field. |
enezaworkflowengine/urls.py |
Manual build_query / save_query routes; namespace enezaworkflowengine. |
myproject/workflowconfig/ (or myproject/workflowconfig.py) |
Project-level workflow configuration (created by the developer). The package form splits type_registry.py, state_choices.py and hooks.py and re-exports them from __init__.py. |