class HelloWorldFlow(Flow):
process_class = HelloWorldProcess
######### Here I start the process where i enter some text
start = (
flow.Start(CreateProcessView, fields=["text"])
.Permission(auto_create=True)
.Next(this.approve)
)
######### Here i update the process view with the user name which i obtained from "asignedto"- which consist of all the user in a drop down
approve = (
flow.View(UpdateProcessView, fields=["asignedto"])
.Assign(lambda act: act.process.created_by)
.Permission(auto_create=True)
.Next(this.task_assign)
)
######### Below is the code where i am facing difficulty i am not able to know how to pass the user name in the .Assign()
######### This one works .Assign(username="Debasish"), however i want to assign the user based on previous workflow which is approve, where i selected from the drop down
######### This one do not work .Assign(username=this.approve.owner)
task_assign = (
flow.View(AssignTaskView)
.Assign(this.approve.owner)
.Next(this.check_approve)
)
######### Below this its working
check_approve = (
flow.If(lambda activation: activation.process.approved)
.Then(this.send)
.Else(this.end)
)
send = flow.Handler(this.send_hello_world_request).Next(this.end)
end = flow.End()
def send_hello_world_request(self, activation):
print(activation.process.text)
问问题
485 次