using process choice in template works in principle now
This commit is contained in:
parent
5541000465
commit
b5b840d230
|
@ -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 %}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue