skip to navigation
skip to content

django-xworkflows 0.12.1

A django app enabling Django models to use xworkflows.

Package Documentation

Use XWorkflows along with Django models.

Django-XWorkflows allow to bind a Django model to a workflow, with a few extra features:

  • Auto-save after transitions
  • Log each action into the database

Define a workflow and add it to a model:

from django import models
from django_xworkflows import models as xwf_models

class MyWorkflow(xwf_models.Workflow):
    states = (
        ('new', _(u"New")),
        ('old', _(u"Old")),
    transitions = (
        ('get_old', 'new', 'old'),
    initial_state = 'new'

class MyModel(xwf_models.WorkflowEnabled, models.Model):

    state = xwf_models.StateField(MyWorkflow)

Use the workflow:

>>> obj = MyModel()
>>> obj.state  # Defaults to the initial_state
>>> # Perform a transition
>>> obj.get_old()
>>> obj.state
>>> # Object was saved to the database
>>> # Logs were saved to the database
>>> xwf_models.TransitionLog.objects.all()
[TransitionLog(MyModel: new -> old at 2012-04-14T12:10:00+0200)]
File Type Py Version Uploaded on Size
django_xworkflows-0.12.1-py2.py3-none-any.whl (md5) Python Wheel py2.py3 2017-09-03 17KB
django_xworkflows-0.12.1.tar.gz (md5) Source 2017-09-03 14KB