Search code examples
djangodjango-signalsdjango-viewflow

Viewflow - start process with Django model post_save signal


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?


Solution

  • Looks like you missed @flow_start_signal decorator

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