我有这样的流程:
review_request = (
flow.View(
ReviewRequest,
).Permission(
auto_create=True
).Next(this.check_response)
)
check_response = flow.If(cond=lambda act: True
).Then(
this.approved_access_request
).Else(
this.refused_access_request
)
approved_access_request = flow.View(
AccessApproved,
).Assign(
this.review_request.owner
).Permission(
auto_create=True
).Next(this.end)
refused_access_request = flow.View(
AccessRefused,
).Assign(
this.review_request.owner
).Permission(
auto_create=True
).Next(this.end)
还有一个观点:
class ReviewRequest(FlowMixin, generic.UpdateView):
template_name = 'web/review-access-request.html'
model = AccessRequest
form_class = ReviewAccessRequestForm
def get_object(self):
return self.activation.process
def request_details(self):
return self.activation.process.access_request
def form_valid(self, form):
form.save()
self.activation_done()
next_view_url = self.get_success_url()
return redirect(next_view_url)
问题是 AccessApproved 和 AccessRefused 的页面不显示。分配部分有效(由管理材料前端显示),但视图未执行。相反,有几秒钟的暂停,浏览器被发送到管理员收件箱。