Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More
lino.core.workflows¶
Defines the classes used for defining workflows. See Introduction to Workflows.
Classes
|
This is the class used when generating automatic "state actions". |
|
A State is a specialized |
|
A workflow is a specialized choicelist used for defining the states of a workflow. |
- class lino.core.workflows.State(value=None, text=None, names=None, **kwargs)¶
Bases:
Choice
A State is a specialized
Choice
that adds theadd_transition()
method.- add_transition(label=None, help_text=None, name=None, icon_name=None, debug_permissions=None, required_states=None, required_roles=None, **kwargs)¶
Declare an transition action which makes an object enter this state.
label can be a string, a subclass of
ChangeStateAction
or None. If it is None, then the state’sbutton_text
ortext
will be used as label.You can specify an explicit name in order to allow replacing the transition action later by another action. Otherwise Lino will generate an internal name.
- class lino.core.workflows.Workflow(*args, **kw)¶
Bases:
ChoiceList
A workflow is a specialized choicelist used for defining the states of a workflow. Every choice is an instance of
State
.- verbose_name¶
The translatable designation for a given state in this workflow.
- verbose_name_plural¶
The translatable designation for the set of existing states in this workflow.
The default value for this is built during startup: if the workflow is being used on a single model (which is the case for most workflows), the default text is “{} states” where {} is the model’s verbose name.
- classmethod on_analyze(site)¶
Add workflow actions to the models which use this workflow so that we can access them as InstanceActions.
- class lino.core.workflows.ChangeStateAction(target_state, required_roles=None, help_text=None, **kw)¶
Bases:
Action
This is the class used when generating automatic “state actions”. For each possible value of the Actor’s
workflow_state_field
there will be an automatic action called mark_XXX- before_execute(ar, obj)¶
This may raise a Warning with a user message to prevent execution.
Usage example : lino_noi.lib.noi.workflows.MarkVoteassigned.