Coder Social home page Coder Social logo

cookbook's Introduction

Viewflow

The low-code for developers with yesterday's deadline

build coverage pypi-version py-versions

Viewflow is a low-code, reusable component library for creating comprehensive business applications with ease. Built on top of Django, Viewflow simplifies development by providing pre-built components for user management, workflows, and reporting, while still offering flexibility to customize and integrate with existing systems.

With Viewflow, you can create full-featured business applications in just a few lines of code using its reusable component library. It's shipped as a single package with batteries included, and each part of Viewflow can be used independently of the others, but they all work well together.

Viewflow comes in two flavors:

  • Viewflow Core: A lightweight, open-source library with only non-opinionated core classes that allows you to build your custom solution on top.
  • Viewflow PRO: A comprehensive package that includes reference functionality implementation and integrated with third-party Django packages. This package has a commercial-friendly license that allows private forks and modifications of Viewflow.

drawing

Features

  • Modern, responsive user interface with an SPA-style look and feel
  • Reusable workflow library for quick implementation of BPMN workflows
  • Built-in customizable CRUD for managing complex forms and data
  • Integrated reporting dashboard
  • Small and concise API

Installation

Viewflow works with Python 3.8 or greater and Django 4.0+

Viewflow:

pip install django-viewflow

Viewflow-PRO:

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

Add 'viewflow' and, in case you need workflow capabilities 'viewflow.workflow' to the INSTALLED_APPS settings.py

    INSTALLED_APPS = [
        ....
        'viewflow',
        'viewflow.workflow',
    ]

Quick start

Here's an example of how to create a simple pizza ordering workflow using Viewflow:

  1. Create a model to store process data

Before creating the workflow, you'll need to define a model to store the process data. Viewflow provides a Process model as the base model for your process instances. You can add your own fields to the model using jsonstore fields to avoid model inheritance and additional joins:

    from viewflow import jsonstore
    from viewflow.workflow.models import Process

    class PizzaOrder(Process):
        customer_name = jsonstore.CharField(max_length=250)
        address = jsonstore.TextField()
        toppings = jsonstore.TextField()
        tips_received = jsonstore.IntegerField(default=0)
        baking_time = jsonstore.IntegerField(default=10)

        class Meta:
            proxy = True
  1. Create a new flow definition file flows.py

Next, create a new flow definition file flows.py and define your workflow. In this example, we'll create a PizzaFlow class that inherits from flow.Flow. We'll define three steps in the workflow: start, bake, and deliver. We'll use CreateProcessView and UpdateProcessView to create and update the process data from PizzaOrder:

    from viewflow import this
    from viewflow.workflow import flow
    from viewflow.workflow.flow.views import CreateProcessView, UpdateProcessView
    from .models import PizzaOrder

    class PizzaFlow(flow.Flow):
        process_class = PizzaOrder

        start = flow.Start(
            CreateProcessView.as_view(
                fields=["customer_name", "address", "toppings"]
            )
        ).Next(this.bake)

        bake = flow.View(
            UpdateProcessView.as_view(fields=["baking_time"])
        ).Next(this.deliver)

        deliver = flow.View(
            UpdateProcessView.as_view(fields=["tips_received"])
        ).Next(this.end)

        end = flow.End()
  1. Add the flow to your URL configuration:

Finally, add the PizzaFlow to your URL configuration. You can use the Site and FlowAppViewset classes to register your workflow with the pre-built frontend.

    from django.urls import path
    from viewflow.contrib.auth import AuthViewset
    from viewflow.urls import Application, Site
    from viewflow.workflow.flow import FlowAppViewset
    from my_pizza.flows import PizzaFlow

    site = Site(
        title="Pizza Flow Demo",
        viewsets=[
            FlowAppViewset(PizzaFlow, icon="local_pizza"),
        ]
    )

    urlpatterns = [
        path("accounts/", AuthViewset().urls),
        path("", site.urls),
    ]
  1. Make and run migrations and access the workflow through the pre-built frontend.

Make and run migrations to create the necessary database tables, then start your Django server and access the workflow through the pre-built frontend. You should be able to create and track pizza orders with the workflow.

Go to the https://docs.viewflow.io/workflow/writing.html for the next steps

Documentation

Viewflow's documentation for the latest version is available at http://docs.viewflow.io/

Documentarian for Viewflow 1.xx series available at http://v1-docs.viewflow.io

Demo

http://demo.viewflow.io/

Cookbook

For sample applications and code snippets, check out the Viewflow PRO cookbook at

https://github.com/viewflow/cookbook

License

Viewflow is an Open Source project licensed under the terms of the AGPL license - The GNU Affero General Public License v3.0 with the Additional Permissions described in LICENSE_EXCEPTION

The AGPL license with Additional Permissions is a free software license that allows commercial use and distribution of the software. It is similar to the GNU GCC Runtime Library license, and it includes additional permissions that make it more friendly for commercial development.

You can read more about AGPL and its compatibility with commercial use at the AGPL FAQ

If you use Linux already, this package license likely won't bring anything new to your stack.

Viewflow PRO has a commercial-friendly license allowing private forks and modifications of Viewflow. You can find the commercial license terms in COMM-LICENSE.

Changelog

2.2.4 2024-07-12

  • Clone data, seed, and artifacts from canceled tasks to revived tasks.
  • Enhance error handling for celery.Job.
  • Improve the process cancellation template.
  • Redirect to the task detail page after canceling or undoing actions, instead of redirecting to the process detail page.
  • Added links to parent subprocess and parent task on the subprocess process and task details pages.
  • Updated the Process.parent_task field to use related_name='subprocess', allowing access to subprocesses via task.subprocess
  • Enhanced CreateProcessView and UpdateProcessView to set process_seed and artifact_generic_foreign_key fields based on form.cleaned_data, as Django model forms do not handle this automatically.
  • Added tasks with an ERROR status to the process dashboard for better visibility and tracking.
  • Added tooltip hover titles to nodes without text labels in the SVG workflow graph.
  • Marked StartHandler nodes as BPMN Start Message events on the SVG graph.
  • Fixed rendering of hidden field errors in forms.

2.2.3 2024-07-09

  • Fixed issue with Split/Join operations when an immediate split to join connection occurs.
  • Improved redirect functionality for "Execute and Continue." Now redirects to the process details if the process has finished.
  • Enabled the Undo action for End() nodes.

2.2.2 2024-07-05

  • Introduced new parameters for .If().Then(.., task_data=, task_seed) and .Else(...)
  • Include {{ form.media }} into default workflow/task.html template

2.2.1 2024-07-03

  • Introduced a new parameter for .Next(..., task_seed=) that allows the instantiation of new tasks with additional initialized .seed generic foreign key
  • Introduced a new parameter for .Split(..., task_seed_source=) same as task_data_source, prodices outgoing tasks with initializaed .seed value
  • Introduced a new parameter for flow.Subprocess(process_data=, process_seed=, task_data=, task_seed=) allows to provide data nad seed for newly created process and/or start task

2.2.0 2024-06-28

  • Introduced a new parameter for .Next(..., task_data=) that allows the instantiation of new tasks with additional initialized .data, enabling data to be passed from task to task.
  • Added process.seed and task.seed generic foreign keys to the default workflow models. Along with process.artifact and task.artifact, these additions enable tracking of business process results from start to finish.
  • Renamed Split.Next(data_source=) to task_data_source=.

cookbook's People

Contributors

dependabot[bot] avatar kmmbvnr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cookbook's Issues

Get flow in shell?

Thanks to author project for this beautiful and helpful app, but I'm a novice and all work fine from demo frontend and nothing from the django code...so I kindly ask you: how the flow can be managed without frontend:

x, created =TestProcess.objects.get_or_create()
Out[1]: (<TestProcess: <Process 19> - NEW>, True)

The process exist

In [12]: x.status
Out[12]: 'NEW'

the status is correct

x.task_set.exists
Out[23]: <bound method BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_method of <django.db.models.fields.related_descriptors.create_reverse_many_to_one_manager.<locals>.RelatedManager object at 0x7f0d917c1438>>

In my flow I've put:

class HellxoWorldFlow(Flow):
    start = (
        flow.Start(
            flow_views.CreateProcessView,
            fields=['text', 'wo_rif'],
            task_title=_('Start'))
        .Permission(auto_create=True)
        .Next(this.secondstep)
    )

but x.flow_class seems to be '', and a "x.next_flow_step" doesn't exist, how can I get the next step for this process?
Thanks, BR

cookbook react_ui backend requirements error

ERROR

ERROR: Invalid requirement: 'pyaml=3.13' (from line 4 of requirements.txt)
Hint: = is not a valid operator. Did you mean == ?
ModuleNotFoundError: No module named 'celery'

django==2.1.2
djangorestframework==3.9.0
django-rest-swagger==2.2.0
was pyaml=3.13 change to pyaml==3.13
django-viewflow-pro==1.4.1
django-material-pro==1.4.1
added celery

Not able to install django-viewflow-pro==1.4.1

I cloned the respository. And run pip install -r requirements.txt , but it gives me error
ERROR: Could not find a version that satisfies the requirement django-viewflow-pro==1.4.1 (from versions: none)
ERROR: No matching distribution found for django-viewflow-pro==1.4.1

How to use viewflo-pro?

cookbook helloworld requirement install failure

pip install -r requirements.txt 
Collecting pytz (from -r requirements.txt (line 1))
  Using cached https://files.pythonhosted.org/packages/e7/f9/f0b53f88060247251bf481fa6ea62cd0d25bf1b11a87888e53ce5b7c8ad2/pytz-2019.3-py2.py3-none-any.whl
Collecting django~=2.2 (from -r requirements.txt (line 2))
  Using cached https://files.pythonhosted.org/packages/2b/b2/eb6230a30a5cc3a71b4df733de95c1a888e098e60b5e233703936f9c4dad/Django-2.2.10-py3-none-any.whl
Collecting django-material-pro<2.0 (from -r requirements.txt (line 3))
  Could not find a version that satisfies the requirement django-material-pro<2.0 (from -r requirements.txt (line 3)) (from versions: )
No matching distribution found for django-material-pro<2.0 (from -r requirements.txt (line 3))

Middleware clean-up error introduced

First, I really appreciate your work on this! That said, I'm very new to JS and know very little about securing logins, but on your last push, when line 20 was added to middleware.js, postponedRSAAs = [] attempts to reallocate a constant array...and fails when compiled. Although slightly slower, I think that this can be avoided with postponedRSAAs.length = 0

Feature Request: Logout functionality in redux-jwt-auth

So, I can login and obtain tokens. Any suggestions on how to implement logout functionality?
I think logout can be achieved by deleting the tokens from localStorage, but is there any cleaner way to do the same?

I have followed the this medium article.

Action on_delete needed

In the Blood Test model (model.py) classes BloodSample, Biochemistry, TumorMarkers, Hormones, BloodTestProcess require a second argument on_delete = for ForeignKey() and OneToOneField() functions

Issue with import storage from 'redux-persist/es/storage'

Hello!
I'm new to React\Redux and I encountered with the problem. I try to follow the Django+React article in my project and get an error. The only presence of that import storage in store.js is enough to get the error.
The example in your repo works just fine, but I can not find the difference between your example and my code. I am using Webpack however.
Here's the error:
VM6423:1 Uncaught SyntaxError: Unexpected identifier at Object.<anonymous> (bundle.js:126) at m (bundle.js:1) at c (bundle.js:1) at Object.eval (eval at <anonymous> (bundle.js:109), <anonymous>:10:16) at Object.eval (eval at <anonymous> (bundle.js:109), <anonymous>:43:27) at eval (eval at <anonymous> (bundle.js:109), <anonymous>:44:30) at Object.<anonymous> (bundle.js:109) at m (bundle.js:1) at c (bundle.js:1) at Object.eval (eval at <anonymous> (bundle.js:108), <anonymous>:21:23)

Here's my webpack.config.js, just in case: https://pastebin.com/q2yye7jy
And here's my dependencies: https://pastebin.com/KuAuw5qD

Column title for composite key

It would be nice if CompositeKey column names refer to model fields instead of database column names. In a legacy database name could be far from today standars. When I tried to use I had to use real column name in CompositeKey, if I use my "new" model name (Django standard) it complains because the column doesn't exist. So I used database column name in model name which makes less clear my code because I'm referring to a related entity by its foreign key instead of my "pretty Django" name.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.