using process choice in template works in principle now

This commit is contained in:
Benni Bärmann 2021-02-02 11:31:40 +01:00
parent 5541000465
commit b5b840d230
2 changed files with 11 additions and 3 deletions

View File

@ -45,7 +45,7 @@
{% endif %}
</p>
</h2>
{% if wizard.steps.step1 == 5 %}
{% if wizard.steps.step1 == 5 or choice == 'CHANGE' %}
{% for key, value in data.items %}
{{ key }}: {{ value }}<p>
{% endfor %}

View File

@ -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)