from viewflow import flow,lock
from viewflow.base import this, Flow
from viewflow.contrib import celery
from viewflow.flow.views import CreateProcessView, UpdateProcessView, Startview
from viewflow import frontend
from viewflow.site import viewsite
from .models import HelloWorldProcess
@frontend.register
class HelloWorldFlow(Flow):
process_class = HelloWorldProcess
lock_impl = lock.select_for_update_lock
start = (
flow.Start
(CreateProcessView,
fields=["text"]
).Permission(auto_create=True)\
.Next(this.approve))
approve = (flow.View(UpdateProcessView,fields=["approved"])\
.Permission(auto_create=True)\
.Next(this.check_approve)
)
check_approve = (
flow.If(lambda activation: activation.process.approved)\
.Then(this.send)\
.Else(this.end)
)
send = (celery.Job(tasks.send_hello_world_request)\
.Next(this.end)
)
end = flow.End()
viewsite.register(HelloWorldFlow)
#def send_question_app_request(self, activation):
#print(activation.process.text)
this is my flow.py
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ea26d0b2-29e9-49a6-808c-b8c12b43d018%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment