首页 > 解决方案 > 没有从 ASSIGNED 视图流的过渡

问题描述

以前我在尝试将进程 pk 分配给外键字段时遇到了视图流问题。似乎问题已解决,但是我收到另一个消息错误,如下所示

No transition from ASSIGNED

似乎错误可能来自我的 flow.py :

class Pipeline(Flow):
process_class = PaymentVoucherProcess

start = (
    flow.Start( 
        CreateProcessView,
        fields=["payment_code","bPBankAccount"]
    ).Permission(
        auto_create=True
    ).Next(this.approve)
)

approve = (
    flow.View(
        Signature,
        fields=["eSignatureModel"]
    ).Permission(
        auto_create=True
    ).Next(this.check_approve)
)

check_approve = (
    flow.If(lambda activation: activation.process.eSignatureModel)
    .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.payment_code)

或我的views.py:

@flow_view
def Signature(request):
    form = SignatureForm(request.POST or None)
    if form.is_valid():
        esig = form.save(commit=False)
        signature = form.cleaned_data.get('signature')
        if signature:
            signature_picture = draw_signature(signature)
            signature_file_path = draw_signature(signature, as_file=True)
        esig.paymentVoucherProcess = request.activation.process
        esig.save()
        request.activation.done()
        return redirect(get_next_task_url(request, request.activate_next.process))

    return render(request, 'cash/pipeline/jsig.html', {
        'form': form,
        'activation': request.activation
    })

谷歌没有给我太多关于如何调试的信息,也许有经验的人可以帮助我?我将不胜感激!

标签: djangoviewflowdjango-viewflowviewflow

解决方案


看来你错过了activation.prepare电话。

对于自定义视图示例,您可以使用 Viewflow 食谱 - https://github.com/viewflow/cookbook/blob/master/custom_views/demo/bloodtest/views.py#L33


推荐阅读