Mixins and Base Classes

Transition Base Classes

Mixins for transition workflows.


class django_transitions.workflow.StatusBase[source]

Base class for transitions and status definitions.

classmethod get_kwargs()[source]

Get the kwargs to initialize the state machine.


class django_transitions.workflow.StateMachineMixinBase[source]

Base class for state machine mixins.

Class attributes:

  • status_class must provide TRANSITION_LABELS property and the get_kwargs class method (see StatusBase).

  • machine is a transition machine e.g:

    machine = Machine(
        **status_class.get_kwargs()  # noqa: C815

The transition events of the machine will be added as methods to the mixin.


Get available workflow transition events for the current state.

Returns a dictionary:
  • transition: transition event.
  • label: human readable label for the event
  • cssclass: css class that will be applied to the button

Get the graph for this machine.

Django Admin Mixins

Mixins for the django admin.

class django_transitions.admin.WorkflowAdminMixin[source]

A mixin to provide workflow transition actions.

It will create an admin log entry.

response_change(request, obj)[source]

Add actions for the workflow events.