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.12.3.tar.gz
(15.1 kB
view details)
Built Distribution
File details
Details for the file django_xworkflows-0.12.3.tar.gz
.
File metadata
- Download URL: django_xworkflows-0.12.3.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48adfd811ca2f0420ce08c3c2d16326fb23033ef1c8186b373b58d5466492d5f |
|
MD5 | f10df7c766bd485477749f6c0f6bc04f |
|
BLAKE2b-256 | c05cb41a0121987ead7f336cc5386196cacde801199e5ae7a3bb872122fa49f1 |
File details
Details for the file django_xworkflows-0.12.3-py2.py3-none-any.whl
.
File metadata
- Download URL: django_xworkflows-0.12.3-py2.py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4054382e87f844d92ea5af16c3bb58cf659cc1df9e706d880ec3bb9c0a9affed |
|
MD5 | 68f498293bc718dc35202fd55eb73fe9 |
|
BLAKE2b-256 | 3741effb1804865fdf6e5cdd05baa85ad18efa2e0ce0a150114b846bbfc2f840 |