A django app enabling Django models to use xworkflows. Compatible with django 3
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
- Doc on https://django-xworkflows.readthedocs.io/
- 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
Built Distribution
Close
Hashes for django_xworkflows_3-0.12.3.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bf53fa5f30b8aaf689d07b6bee4cd4a3447a8565189cb2861c6eeb762a5867c |
|
MD5 | da23317fd25f6f01436c3600b608f4e8 |
|
BLAKE2-256 | 71b972c71dfde9ecfb354f1d66cc9a3c3a6f33d0b846f4dd129dc35a067e67af |
Close
Hashes for django_xworkflows_3-0.12.3.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4abbdb9cd8167577146347b2af30319585525dd34e7ccadd782c8e0d7d9331ac |
|
MD5 | a835be7e8ae421cbb58b654b048b8c8c |
|
BLAKE2-256 | 2e63ab5b2cc347af1e6b7496166dcdd6dcd66dc3f5f0c840b57553ad23c430ea |