From b5b840d230443aa38b045cf58a3b6a59dfc919b1 Mon Sep 17 00:00:00 2001
From: Benni Baermann
{% endfor %} diff --git a/evapp/views.py b/evapp/views.py index 75705d2..7fe8fbb 100644 --- a/evapp/views.py +++ b/evapp/views.py @@ -23,12 +23,19 @@ class EvaFormView(CookieWizardView): template_name = 'evapp/employee_form.html' form_list = [PersonalForm, WorkingForm, ITForm, OfficeForm, DummyForm] instance = None + choice = 'IN' + + def get_all_cleaned_data(self): + data = super().get_all_cleaned_data() + del data['choice'] + return data # we need this to display all the data in the last step def get_context_data(self, form, **kwargs): context = super().get_context_data(form=form, **kwargs) - if (self.steps.current == 5): - context.update({'data': self.beautify_data(self.get_all_cleaned_data())}) + if (self.steps.current == 5 or self.choice == 'CHANGE'): + context.update({'data': self.beautify_data(self.get_all_cleaned_data()), + 'choice' : self.choice}) return context #this makes shure, that we use the same model instance for all steps @@ -63,6 +70,7 @@ class EvaFormView(CookieWizardView): prev_data = self.get_cleaned_data_for_step('0') choice = prev_data.get('choice') print(f'choice detection: {TYPE_CHOICES[choice]}') + self.choice = choice if choice == 'CHANGE': print("process choosen: CHANGE") form = ChangeForm(data)