{ "info": { "author": "Daniele Bernardini", "author_email": "db@intranetstandard.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Topic :: Software Development :: Build Tools" ], "description": "===============\nDjango Workflow\n===============\n\nThis project aim is to provide a simple database driven workflow engine that you can use to configure and\nautomate complex operations. It is based on configurable state machines that are defined at runtime through the admin\ninterface.\n\nWorkflow Definition\n-------------------\n\nA workflow is defined by the following objects:\n\n:Workflow: main object, it must have a unique ``name``\n:State: objects which represent the nodes of the graph they are ``workflow`` specific\n:Transition: Transitions can be manual or automatic,\n automatic transitions are executed asynchrnously as soon as an object reaches their intial state.\n Of course only one automatic transition can be executed at the time and it will normally change the state\n so that other transitions which were defined for the intial state cannot be executed anymore.\n Which transition is executed depends on the ``priority`` and on the related conditions\n:Condition: objects which limit the execution of transitions based on the properties of the object\n which is undergoing the process, of the user or on generic queries. Conditions are hierarchical and\n can be combined using special boolean conditions\n:Function: For every condition ``C`` of type function there must be a function which has value ``C`` for the condition.\n The function specifies the python function which will be called to check if the condition is fulfilled.\n:FunctionParameter: Each function parameter is passed as kwarg to its ``function``\n:Callback: A callback defines a python function which should be called when a transition occurs,\n usually for required side effect. The callback will be called either within the same transaction and before\n the update of the object state, if ``execute_async`` is ``False`` or after the after the status\n has been updated in an independent thread\n:CallbackParameter: Each callback parameter is passed as kwarg to its ``callback``\n\nBelow you can find a simple example of a 3 states workflow with a mix of manual and automatic transitions\n\n::\n\n from django.contrib.auth.models import User\n from django_workflow import workflow\n from django_workflow.models import Workflow, State, Transition, Condition, Function, FunctionParameter, Callback, CallbackParameter\n\n # create the main workflow object\n wf = Workflow.objects.create(name=\"Test_Workflow\", object_type=\"django.contrib.auth.models.User\")\n # create 3 states\n s1 = State.objects.create(name=\"state 1\", workflow=wf, active=True, initial=True)\n s2 = State.objects.create(name=\"state 2\", workflow=wf, active=True)\n #the final state is defined as inactive so that its skipped when scanning for automatic transitions\n s3 = State.objects.create(name=\"state 3\", workflow=wf, active=False)\n # create the transitions, we have 2 automatic transitions from state 1 to state 2,\n # the first is going to be executed despite t4 having a better priority because\n # t1 has a lower automatic_delay\n t1 = Transition.objects.create(name=\"auto_fast\", initial_state=s1, final_state=s2, automatic=True, automatic_delay=1.0/24.0/3600.0, priority=2)\n t4 = Transition.objects.create(name=\"auto_slow\", initial_state=s1, final_state=s3, automatic=True,\n automatic_delay=1.0 / 24.0, priority=1)\n t2 = Transition.objects.create(initial_state=s1, final_state=s3, automatic=False)\n t3 = Transition.objects.create(initial_state=s2, final_state=s3, automatic=False)\n # we set t3 to be executed only by superusers this can be done with a object_attribute_value conditon\n c1 = Condition.objects.create(condition_type=\"function\", transition=t3)\n f1 = Function.objects.create(\n function_name=\"object_attribute_value\",\n function_module=\"django_workflow.conditions\",\n condition=c1\n )\n p11 = FunctionParameter.objects.create(function=f1, name=\"attribute_name\", value=\"is_superuser\")\n p12 = FunctionParameter.objects.create(function=f1, name=\"attribute_value\", value=\"True\")\n # we want to print out if transition 1 was executed, this can be done with a callback\n cb1 = Callback.objects.create(transition=t1, function_name=\"_print\", function_module=\"django_workflow.tests\", order=1)\n cp11 = CallbackParameter.objects.create(callback=cb1, name=\"text\", value=\"Transition 1 Executed\")\n\n\nStates and Transitions\n----------------------\nOnce the workflow is defined one can add objects to the workflow\n\n::\n\n obj = MyModelObject.objects.get(name=\"MyObjectName\")\n wf = workflow.get_workflow(\"Test_Workflow\")\n wf.add_object(obj.id)\n\nThe method ``add_object`` beside starting the tracking of the object in the state machine, it also triggers\nany automatic transition available in the initial state\n\nTo check the state of an object one can use:\n\n::\n\n workflow.get_object_state(\"Test_Workflow\", object_id)\n\nand to check for available transition, e.g. to know which buttons you can show in the UI, you can call\n\n::\n\n workflow.get_available_transitions(\"Test_Workflow\", user, object_id)\n\nwhere ``user`` should be the Django user that wishes to perform the action. The ``user`` is passed to\neach condition and callback so it is useful to check for authorization as well as to perform specific tasks,\ne.g. notifications", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dani0805/django_workflow", "keywords": "workflow state machine development", "license": "BSD-3-Clause", "maintainer": "", "maintainer_email": "", "name": "django-wf", "package_url": "https://pypi.org/project/django-wf/", "platform": "", "project_url": "https://pypi.org/project/django-wf/", "project_urls": { "Homepage": "https://github.com/dani0805/django_workflow" }, "release_url": "https://pypi.org/project/django-wf/0.9.1/", "requires_dist": null, "requires_python": "", "summary": "A simple database driven workflow engine", "version": "0.9.1" }, "last_serial": 3132399, "releases": { "0.9": [], "0.9.1": [ { "comment_text": "", "digests": { "md5": "24e4570b8204dfeed0b95b7183927ee8", "sha256": "862280a5478d60a52c47e1bb5d65680818344bc684bc0d1c140987ddb2def834" }, "downloads": -1, "filename": "django_wf-0.9.1-py2.7.egg", "has_sig": false, "md5_digest": "24e4570b8204dfeed0b95b7183927ee8", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 31995, "upload_time": "2017-08-29T16:11:59", "url": "https://files.pythonhosted.org/packages/d4/06/ac822e243978bf6af1af1ba2525d2736b5679d875f23a8ce07f9f60d9c4f/django_wf-0.9.1-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "d1fb7cdf5df2cc8814577e19419317db", "sha256": "3e4d19059310bb08ae39f38c7264826029205fb3aa7731e1969a61bb5701c7e2" }, "downloads": -1, "filename": "django-wf-0.9.1.tar.gz", "has_sig": false, "md5_digest": "d1fb7cdf5df2cc8814577e19419317db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13992, "upload_time": "2017-08-29T16:11:56", "url": "https://files.pythonhosted.org/packages/d6/10/61a130144931637dee9cb4e87ed4a024fb1f86f9996fd0164b7cb15eed17/django-wf-0.9.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "24e4570b8204dfeed0b95b7183927ee8", "sha256": "862280a5478d60a52c47e1bb5d65680818344bc684bc0d1c140987ddb2def834" }, "downloads": -1, "filename": "django_wf-0.9.1-py2.7.egg", "has_sig": false, "md5_digest": "24e4570b8204dfeed0b95b7183927ee8", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 31995, "upload_time": "2017-08-29T16:11:59", "url": "https://files.pythonhosted.org/packages/d4/06/ac822e243978bf6af1af1ba2525d2736b5679d875f23a8ce07f9f60d9c4f/django_wf-0.9.1-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "d1fb7cdf5df2cc8814577e19419317db", "sha256": "3e4d19059310bb08ae39f38c7264826029205fb3aa7731e1969a61bb5701c7e2" }, "downloads": -1, "filename": "django-wf-0.9.1.tar.gz", "has_sig": false, "md5_digest": "d1fb7cdf5df2cc8814577e19419317db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13992, "upload_time": "2017-08-29T16:11:56", "url": "https://files.pythonhosted.org/packages/d6/10/61a130144931637dee9cb4e87ed4a024fb1f86f9996fd0164b7cb15eed17/django-wf-0.9.1.tar.gz" } ] }