django-viewflow

django-viewflow

Released 3 years ago , Last update 3 years ago

A package to create simple workflows as an alternative to sets of complex Django views.

Rather than creating Django views and linking them together, django-viewflow helps you build simple workflows. The Django package also includes an Business Process Modeling Notation (BPMN) API for planning viewflows with charts.

Features:

  • Simple integration with Django views, signals and models.
  • User and background task support.
  • Complex Split/Joins for parallel task execution.
  • Boilerplate urls registration and permission check handling.

See a live demo: here.

Pricing

14 day 14-day money-back guarantee

FREE

GNU AGPL

The GNU AGPL is an open-source license.

$4,499.99

Appliance license

  • Perpetual license

  • Unlimited projects

  • Can distribute code and binary products

  • Commercial use

  • 12 months support

Need custom services for this product? Get a quote

Documentation & Setup

Documentation

The complete documentation can be found here, on out website.

Setup

After purchasing django-viewflow, you'll immediately receive the source code. Within 24 hours, you'll receive an email with a license ID, which allows to access to private PyPi repository with code updates.

To install, use the following command:

pip install django-viewflow-pro --extra-index-url https://pypi.viewflow.io/<license_id>/simple/

Or add the following statement to your project's requirements.txt:

--extra-index-url https://pypi.viewflow.io/<licence_id>/

Next, add viewflow to INSTALLED_APPS in your settings.

INSTALLED_APPS = (
     ...
     'viewflow',
)

Example usage

1. Create the Model

Define the database model.

from django.db import models
from viewflow.models import Process

class HelloWorldProcess(Process):
    text = models.CharField(max_length=150)
    approved = models.BooleanField(default=False)

2. Create a Task

Create a task that says, "Hello to the World" in tasks.py:

import os

from celery import shared_task
from viewflow.flow import flow_job

@shared_task()
@flow_job()
def send_hello_world_request(activation):
    with open(os.devnull, "w") as world:
        world.write(activation.process.text)

3. Define a Flow

To make the task work, just put the following flow definition in your application's flows.py module.

from viewflow import flow
from viewflow.base import this, Flow
from viewflow.contrib import celery
from viewflow.views import StartProcessView, ProcessView
from . import models, tasks

class HelloWorldFlow(Flow):
    process_cls = models.HelloWorldProcess

    start = flow.Start(StartView, fields=["text"]) \
        .Permission(auto_create=True) \
        .Next(this.approve)

    approve = flow.View(ProcessView, fields=["approved"]) \
        .Permission(auto_create=True) \
        .Next(this.check_approve)

    check_approve = flow.If(cond=lambda p: p.approved) \
        .OnTrue(this.send) \
        .OnFalse(this.end)

    send = celery.Job(tasks.send_hello_world_request) \
        .Next(this.end)

    end = flow.End()

4. Add URLs

Flow class contains all URLs required for processing the task.

from django.conf.urls import patterns, url, include
from viewflow import views as viewflow
from .flows import HelloWorldFlow


urlpatterns = patterns('',
    url(r'^helloworld/',
        include([
            HelloWorldFlow.instance.urls,
            url('^$', viewflow.ProcessListView.as_view(), name='index'),
            url('^tasks/$', viewflow.TaskListView.as_view(), name='tasks'),
            url('^queue/$', viewflow.QueueListView.as_view(), name='queue'),
            url('^details/(?P\d+)/$',
                viewflow.ProcessDetailView.as_view(), name='details')],
                namespace=HelloWorldFlow.instance.namespace),
        {'flow_cls': HelloWorldFlow}))

Now, your Hello World process is ready to go. If you run the development server locally, go to http://localhost:8000/flows/helloworld/ and go through the workflow.

Check out this example's source code here, and watch a video walkthrough of it here.

3 licenses, starting from From » FREE View Licenses

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.

or Get a quote

for customization or integration services


Or enter your name and Email
  • SJ Sakshi Jain 7 months ago
    Did not like the documentation. Cannot find good code examples anywhere either.