WMDE
/
eva
forked from tohe/eva
7
1
Fork 0

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

View File

@ -23,12 +23,19 @@ class EvaFormView(CookieWizardView):
template_name = 'evapp/employee_form.html' template_name = 'evapp/employee_form.html'
form_list = [PersonalForm, WorkingForm, ITForm, OfficeForm, DummyForm] form_list = [PersonalForm, WorkingForm, ITForm, OfficeForm, DummyForm]
instance = None 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 # we need this to display all the data in the last step
def get_context_data(self, form, **kwargs): def get_context_data(self, form, **kwargs):
context = super().get_context_data(form=form, **kwargs) context = super().get_context_data(form=form, **kwargs)
if (self.steps.current == 5): if (self.steps.current == 5 or self.choice == 'CHANGE'):
context.update({'data': self.beautify_data(self.get_all_cleaned_data())}) context.update({'data': self.beautify_data(self.get_all_cleaned_data()),
'choice' : self.choice})
return context return context
#this makes shure, that we use the same model instance for all steps #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') prev_data = self.get_cleaned_data_for_step('0')
choice = prev_data.get('choice') choice = prev_data.get('choice')
print(f'choice detection: {TYPE_CHOICES[choice]}') print(f'choice detection: {TYPE_CHOICES[choice]}')
self.choice = choice
if choice == 'CHANGE': if choice == 'CHANGE':
print("process choosen: CHANGE") print("process choosen: CHANGE")
form = ChangeForm(data) form = ChangeForm(data)