Skip to main content

A django app enabling Django models to use xworkflows.

Project description

https://secure.travis-ci.org/rbarrois/django_xworkflows.png?branch=master Latest Version Supported Python versions Wheel status License

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
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.10.1.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

django_xworkflows-0.10.1-py2-none-any.whl (13.6 kB view details)

Uploaded Python 2

File details

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

File metadata

File hashes

Hashes for django-xworkflows-0.10.1.tar.gz
Algorithm Hash digest
SHA256 fb661d2cd0bb1840cf138ddc3413eb35b7ad103dda33868717e72d6e6e056095
MD5 dd8b7dbf4d6ccf80b33bd50abf0f7766
BLAKE2b-256 dd2924fd626ebd8128a7e1764884050a4d7034bb9698abf5a62a661b2d2186dd

See more details on using hashes here.

File details

Details for the file django_xworkflows-0.10.1-py2-none-any.whl.

File metadata

File hashes

Hashes for django_xworkflows-0.10.1-py2-none-any.whl
Algorithm Hash digest
SHA256 cc4cb05ed1932ae8728873a9351dbea7147dd0ba4fd00c5985c35c770282fb63
MD5 ec34652ffc2d0fdbffe69a6a3dba9d02
BLAKE2b-256 213e7ab51fe2fa7d39182625e85fbc0715f5db7317ae71fdc908053460ee0188

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