Skip to main content

Manage all events on workflows

Project description

https://travis-ci.org/unistra/django-workflow-activity.svg?branch=master https://coveralls.io/repos/unistra/django-workflow-activity/badge.svg?branch=master

Install

Install the package via pypi:

pip install django-workflow-activity

Add the installed application in the django settings file:

INSTALLED_APPS = (
    ...
    'workflow_activity'
)

Migrate the database:

python manage.py migrate

Usage

To create workflows and permissions, see the following documentations:

To use workflow activity methods on a class :

from workflow_activity.models import WorkflowManagedInstance

class MyClass(WorkflowManagedInstance):
    ...

To add a workflow to an object:

myobj = MyClass()
myobj.set_workflow('My workflow')

Now, you can use methods on your object like:

myobj.last_state()
myobj.last_transition()
myobj.last_actor()
myobj.last_action()
myobj.allowed_transitions(request.user)
myobj.is_editable_by(request.user, permission='edit')
myobj.state()
myobj.change_state(transition, request.user)
...

And managers like:

MyClass.objects.filter()
MyClass.pending.filter()
MyClass.ended.filter()
...

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-workflow-activity-1.1.0.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

django_workflow_activity-1.1.0-py2.py3-none-any.whl (10.1 kB view hashes)

Uploaded Python 2 Python 3

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