我已经实现了一个由4个表单组成的向导。但是我需要对某个变量进行检查,然后将其设置为True,转到下一步,转到上一步。 我在流程步骤内: -
def process_step(self, form):
"""
you can save the form here,
since it's guaranteed to be valid
"""
guest_user = False
if self.steps.current == "step1":
step1_data = self.get_form_step_data(form)
if self.steps.current == "step2":
step2_data = self.get_form_step_data(form)
if self.steps.current == "step3":
step3_data = self.get_form_step_data(form)
if self.steps.current == "step4":
step4_data = self.get_form_step_data(form)
inv_data = check_inventory_for_cart_items(self.request)
# At this point i want to redirect to step3
if not inv_data[0] == True:
messages.error(self.request, "Some Items Out of stock. Please check in order summary")
return
return super(SinglePageCheckoutWizard, self).process_step(form)
因为你可以我返回,因此它重定向到相同的步骤模板 但我希望它应该重定向到上一步模板。
由于