Viewflow - start process with Django model post_save signal

≯℡__Kan透↙ 提交于 2019-12-24 20:38:12

问题


Is there a way to start a Viewflow process with Django model post_save signal. I managed to do this:

//start viewflow process
start = (
    flow.StartSignal(post_save, create_dest_flow)
        .Next(this.approve)
)

//create flow function
def create_dest_flow(**kwargs):
   print("Test")
   pass

The "Test" string is printed for every save on any model. If I add activation to the create flow function parameteres I get an error: missing 1 required positional argument: 'activation'. How to start the flow only on specific model post_save signal?


回答1:


Looks like you missed @flow_start_signal decorator

http://docs.viewflow.io/viewflow_core_node.html#viewflow.nodes.StartSignal



来源:https://stackoverflow.com/questions/53980834/viewflow-start-process-with-django-model-post-save-signal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!