From 17a52a46dc9617d2fdf52311a34718153f1ad112 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Thu, 4 Feb 2021 12:17:05 +0100 Subject: [PATCH] fix of process handling with "choice" --- evapp/templates/evapp/employee_form.html | 1 + evapp/views.py | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/evapp/templates/evapp/employee_form.html b/evapp/templates/evapp/employee_form.html index 3a35333..ba17a57 100644 --- a/evapp/templates/evapp/employee_form.html +++ b/evapp/templates/evapp/employee_form.html @@ -32,6 +32,7 @@

Schritt {{ wizard.steps.step1 }} von {{ wizard.steps.count }}

+ Choice: {{choice}}

{% if wizard.steps.step1 == 1 %} Angaben zur Person {% endif %} {% if choice == 'IN' %} diff --git a/evapp/views.py b/evapp/views.py index deb129d..6b8bf9a 100644 --- a/evapp/views.py +++ b/evapp/views.py @@ -66,10 +66,11 @@ class EvaFormView(CookieWizardView): # we need this to display all the data in the last step def get_context_data(self, form, **kwargs): + print('GETCONTEXT') context = super().get_context_data(form=form, **kwargs) - if (self.steps.current == 5 or self.choice == 'CHANGE'): - context.update({'data': self.beautify_data(self.get_all_cleaned_data()), - 'choice' : self.choice}) + context.update({'choice': self.choice}) + if (self.steps.current == 5 or (self.choice == 'CHANGE' and self.steps.current ==3)): + context.update({'data': self.beautify_data(self.get_all_cleaned_data())}) return context #this makes shure, that we use the same model instance for all steps @@ -155,7 +156,7 @@ class EvaFormView(CookieWizardView): # This implementation works only for unique keys over all of these dicts from model.py # def beautify_data(self, data): - + print("BEAUTIFY") # update values in data dictionary with keys from *_CHOICES if present there choices = {**DEPARTMENT_CHOICES, **LAPTOP_CHOICES, **TRANSPONDER_CHOICES, **OS_CHOICES, **MOBILE_CHOICES, **LANG_CHOICES,}