django - 没有从 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
})
谷歌没有给我太多关于如何调试的信息,也许有经验的人可以帮助我?我将不胜感激!
解决方案
看来你错过了activation.prepare
电话。
对于自定义视图示例,您可以使用 Viewflow 食谱 - https://github.com/viewflow/cookbook/blob/master/custom_views/demo/bloodtest/views.py#L33
推荐阅读
- python - 带有 BERT 分词器的 CUDA 并行 for 循环
- android - 如何解码 android 中风格的 url?
- python - Odoo14 如何在模板中使用变量
- javascript - 我需要在我的代码中更改哪些模式才能在我的登录按钮上工作?
- vue.js - Vue apollo 将结果添加到数组
- python - 我如何使用 BeautifulSoup 从这个网站获取价格?
- php - erc20token转移后如何获得完成、失败、挂起状态
- python - 通过 url-ftp 写入 txt 文件
- javascript - 使用 JavaScript 打开具有定义属性的 PDF 格式
- java - 如何与子线程共享父 ThreadLocal 对象引用?