django - Form Wizard: Redirecting back to a previous step when validation fails -
i have implemented wizard consist of 4 forms.however need put check on variable true go next step else go previous step. inside process step:-
def process_step(self, form): """ can save form here, since it's guaranteed 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) # @ point want redirect 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)
as can have put return , hence redirects same step template want should redirect previous step template.
thanks
Comments
Post a Comment