2👍
Generally, that sample is about non-dynamic workflow. All nodes instances counts are known at the moment of workflow definitions.
If you think about the flow from the process modeling side, visual representation and explanation to a non-technical user, the flow would be modeled as following BPMN diagram that not a far away from the textual specification:
So this directly could be translated into the viewflow class definition, where django views for the same tasks could be reused over different flow nodes, ex:
class MyFlow(Flow):
start = flow.Start(ViewT1).Next(check_role)
check_role = (
flow.Switch()
.Case(this.user_t2, cond=lambda act: act.process.created_by.role=='USER')
.Case(this.admin_t2, cond=lambda act: act.process.created_by.role=='ADMIN')
...
)
user_t2 = flow.View(ViewT2).Next(this.user_t3)
admin_t2 = flow.View(ViewT2).Next(this.admin_t4)
...
Ability to have the code that looks pretty same as the textual and visual specification the main value of the viewflow library. To do that for some cases you will need to create your own flow nodes. In the viewflow samples, you can find a dynamic split node that show how to be, if the nodes instance counts are unknown at the design time.