django-fsm icon indicating copy to clipboard operation
django-fsm copied to clipboard

How can I have multiple workflows in the same template?

Open pmpr88 opened this issue 2 years ago • 4 comments

The need is that depending on the type of article, I have to choose a custom workflow model.

pmpr88 avatar Jan 26 '22 11:01 pmpr88

Do you mean, how to start different flows from a single page?

What is your Viewflow setup? Do you use frontend or write custom views?

Could you have just a single flow with flow.If after start to select different path ?

kmmbvnr avatar Jan 26 '22 14:01 kmmbvnr

Yes, single page.

I have a specific form, and depending on the type of article, I want to start a different workflow.

At this point I created the workflow at the Model level. But i need to be able to choose the workflow.

pmpr88 avatar Jan 26 '22 14:01 pmpr88

Here's an example, i have a Model Product, but i have two types of products, cars and trains. Each on of them has a diferent workflow.

Product is a Car Kick-off -> Design Validation -> Release

Product is Train Kick-off -> Concept Validation -> Design Validation -> Release

When i create a product, i choose the type(car/train) and i choose respective workflow.

Is this possible?

pmpr88 avatar Feb 08 '22 10:02 pmpr88

there are some tricks that django-fsm could handle this with proxy models, but generally I recommended to switch to my another project django-viewflow==2.0.0b

viewflow.fsm is not model based, and you can instanticate any fsm flow explicitly on the view

https://docs-next.viewflow.io/fsm/models.html

kmmbvnr avatar Feb 08 '22 10:02 kmmbvnr