Skip to content

workflow.models ​

Overview ​

Workflow state machine models: workflows, states, transitions, permissions, and object state tracking.

Classes ​

ensure_object_state ​

post_save receiver that gives a saved workflow object its ObjectState if it has none.

It receives every model's saves, including a proxy's, whose sender is the proxy class. A raw save loads a fixture, which carries its own object state rows, so it creates nothing.

Signature ​

ensure_object_state(sender, instance, raw, kwargs)

Parameters ​

NameTypeRequiredDefaultDescription
senderyes
instanceyes
rawnoFalse
kwargsno

Source ​

server/vueda/workflow/models.py:1110

get_workflow_for_model ​

Return the Workflow of model, which enables class Vueda.Workflow.

Every read of a workflow model's definition goes through here, so a missing one raises WorkflowNotConfiguredError wherever it is first needed instead of reading as "no workflow". A proxy resolves to its concrete model's definition.

Signature ​

get_workflow_for_model(model)

Parameters ​

NameTypeRequiredDefaultDescription
modelyes

Returns ​

vueda.workflow.models.Workflow

Source ​

server/vueda/workflow/models.py:571

object_state_events ​

Name the workflow state changes of instance for its history.

These are the update events of the object's ObjectState row. The row's insert records the object's initial state rather than a transition, so history leaves it out. Returns None when the model does not enable workflow or the object has no ObjectState row.

Signature ​

object_state_events(instance)

Parameters ​

NameTypeRequiredDefaultDescription
instanceyes

Source ​

server/vueda/workflow/models.py:584

objects_without_object_state ​

Return the objects of model that have no ObjectState row in workflow.

Read through the base manager, so a default manager that hides rows does not hide them here. An object in this queryset has no current state, which leaves it out of state filters and state grants and makes its transitions fail. backfillworkflowstates gives each one the initial state.

Signature ​

objects_without_object_state(model, workflow)

Parameters ​

NameTypeRequiredDefaultDescription
modelyes
workflowyes

Source ​

server/vueda/workflow/models.py:615

Source ​

server/vueda/workflow/models.py