def get_context_data(self, form, **kwargs): context = SessionWizardView.get_context_data(self, form, **kwargs) # Check if we are adding a new or editing an existing recipe if 'recipe_id' in self.kwargs: context['new_recipe'] = False else: context['new_recipe'] = True for step in self.steps.all: context['%s_form_valid' % step] = self.form_is_valid(step) return context
def get_context_data(self, form, **kwargs): context = SessionWizardView.get_context_data(self, form, **kwargs) context['passed'] = self.steps.all[:self.steps.index] context['not_passed'] = self.steps.all[self.steps.index:] data = {} form_data = self.get_all_cleaned_data() for step in context['passed']: data[step] = self.form_list[step](data=form_data) context['step_data'] = data return context