我正在使用位于ViewFlow cookbook上的HelloWorld示例。
整个源代码与helloworld
项目相同,唯一的变化是:
flows.py
check_approve = (
flow.If(lambda activation: activation.process.approved)
.Then(this.send)
.Else(this.start) # Edited (was this.end)
)
因此,基本上我打算,如果用户将Approved
复选框保持为未选中状态并继续进行操作,则它将把任务推回到开始步骤。
运行此错误消息:
NotImplementedError at /workflow/helloworld/helloworld/3/approve/11/
No exception message supplied
Internal Server Error: /workflow/helloworld/helloworld/3/approve/11/
Traceback (most recent call last):
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/utils/decorators.py", line 67, in _wrapper
return bound_func(*args, **kwargs)
File "/usr/lib/python3.6/contextlib.py", line 52, in inner
return func(*args, **kwds)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/decorators.py", line 213, in _wrapper
return view(request, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/utils/decorators.py", line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/flow/views/task.py", line 70, in dispatch
return super(BaseFlowMixin, self).dispatch(request, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/views/generic/edit.py", line 240, in post
return super(BaseUpdateView, self).post(request, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/views/generic/edit.py", line 183, in post
return self.form_valid(form)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/flow/views/task.py", line 86, in form_valid
self.activation_done(*args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/flow/views/task.py", line 78, in activation_done
self.activation.done()
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/fsm.py", line 44, in __call__
return self.descriptor(self.instance, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/fsm.py", line 112, in __call__
result = self.func(instance, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/activation.py", line 384, in done
self.activate_next()
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/fsm.py", line 44, in __call__
return self.descriptor(self.instance, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/fsm.py", line 112, in __call__
result = self.func(instance, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/activation.py", line 396, in activate_next
self.flow_task._next.activate(prev_activation=self, token=self.task.token)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/__init__.py", line 154, in activate
return self.activation_class.activate(self, prev_activation, token)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/activation.py", line 561, in activate
activation.perform()
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/fsm.py", line 44, in __call__
return self.descriptor(self.instance, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/fsm.py", line 112, in __call__
result = self.func(instance, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/activation.py", line 525, in perform
self.activate_next()
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/fsm.py", line 44, in __call__
return self.descriptor(self.instance, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/fsm.py", line 169, in __call__
result = self.func(instance, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/nodes/ifgate.py", line 24, in activate_next
self.flow_task._on_false.activate(prev_activation=self, token=self.task.token)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/__init__.py", line 154, in activate
return self.activation_class.activate(self, prev_activation, token)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/activation.py", line 216, in activate
raise NotImplementedError
NotImplementedError
答案 0 :(得分:2)
问题似乎是您尝试跳转到else语句中的flow.Start元素。请尝试跳至而是一个flow.View元素。