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 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)]
Links
Package on PyPI: http://pypi.python.org/pypi/django-xworkflows
Repository and issues on GitHub: http://github.com/rbarrois/django_xworkflows
XWorkflows on GitHub: http://github.com/rbarrois/xworkflows
Project details
Release history Release notifications | RSS feed
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.0.tar.gz
(17.3 kB
view details)
Built Distribution
File details
Details for the file django-xworkflows-0.10.0.tar.gz
.
File metadata
- Download URL: django-xworkflows-0.10.0.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5860b65738582114e9eccd2dddfbbef366c05904c93495879ea9eae3b2bf4f20 |
|
MD5 | e11f549e2924027630ab2ae702bcc59c |
|
BLAKE2b-256 | 1cadd2dcec8dce17ef46f8337a622a1b515a21a4a253d9f0a1d41575df1666f2 |
File details
Details for the file django_xworkflows-0.10.0-py3-none-any.whl
.
File metadata
- Download URL: django_xworkflows-0.10.0-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d00ac06c1c4e011f7c74bc8eabd032ad8b2a978ce4beca1d96f1e9dd0200d38a |
|
MD5 | 800238759753fd3c205a00033fe0bc3e |
|
BLAKE2b-256 | b0ffe329c5fbf2fc3b4d7e28f2d5acb189900722ea9fa358a86cb44bb7ed88f5 |