Skip to main content

A django app enabling Django models to use xworkflows.

Project description

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_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):

    state = xwf_models.StateField(MyWorkflow)

Use the workflow:

>>> obj = MyModel()
>>> obj.state  # Defaults to the initial_state
State('new')
>>> # Perform a transition
>>> obj.get_old()
>>> obj.state
State('old')
>>> # Object was saved to the database
>>> obj.pk
1
>>> # Logs were saved to the database
>>> xwf_models.TransitionLog.objects.all()
[TransitionLog(MyModel: new -> old at 2012-04-14T12:10:00+0200)]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-xworkflows-0.4.5.tar.gz (18.3 kB view details)

Uploaded Source

File details

Details for the file django-xworkflows-0.4.5.tar.gz.

File metadata

File hashes

Hashes for django-xworkflows-0.4.5.tar.gz
Algorithm Hash digest
SHA256 7420ef2ca2f394cf8f1ff2b006a0dd279a9d2fc9ed2da65194025e559d201bb8
MD5 7734d9ef2b398e7d23e1f097945cc5d8
BLAKE2b-256 3a20cc5cd27b01bde442fbb61616bb2c6a1d4a7e752f419fb0be723ff806d422

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page