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

Uploaded Source

Built Distribution

django_xworkflows-0.12.0-py2.py3-none-any.whl (18.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django_xworkflows-0.12.0.tar.gz.

File metadata

File hashes

Hashes for django_xworkflows-0.12.0.tar.gz
Algorithm Hash digest
SHA256 547583290de2a77ec87d3d183408c10343f7d5f973e2bf14cb85578c5e89a7d5
MD5 75f1e1a6da67112ea6b4471bd3f66e51
BLAKE2b-256 14bae7e9b655f8bcd8c757bc22f8cfad9f61abc85d770209aa90ece2a23fa986

See more details on using hashes here.

File details

Details for the file django_xworkflows-0.12.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_xworkflows-0.12.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6eee9dbbfe345901ada14f20d857531637662577c12af0a30437f42129048035
MD5 064ef861b9d16df98fbbf42f85b19e0b
BLAKE2b-256 54e386cfb27352acf9761c2834274f8dd3a828f68c429a63fbdaf421c0bec848

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