fixed context data in last step
This commit is contained in:
parent
f6bdaa01d5
commit
3a3b7f25cb
|
@ -1,3 +1,4 @@
|
|||
dataloop
|
||||
{% for key, value in data.items %}
|
||||
{{ key }}: {{ value }}
|
||||
{% endfor %}
|
||||
|
|
|
@ -45,7 +45,11 @@
|
|||
{% endif %}
|
||||
</p>
|
||||
</h2>
|
||||
|
||||
{% if wizard.steps.step1 == 5 %}
|
||||
{% for key, value in data.items %}
|
||||
{{ key }}: {{ value }}<p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
|
|
|
@ -49,10 +49,18 @@ class EvaFormView(CookieWizardView):
|
|||
template_name = 'evapp/employee_form.html'
|
||||
form_list = [PersonalForm, WorkingForm, ITForm, OfficeForm, DummyForm]
|
||||
instance = None
|
||||
data = {}
|
||||
# form_class = EmployeeForm
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse('success')
|
||||
def get_context_data(self, form, **kwargs):
|
||||
context = super().get_context_data(form=form, **kwargs)
|
||||
# self.data.update(form.cleaned_data)
|
||||
# if self.steps.current == '5':
|
||||
context.update({'data': self.get_all_cleaned_data()})
|
||||
return context
|
||||
|
||||
# def get_success_url(self):
|
||||
# return reverse('success')
|
||||
|
||||
#this makes shure, that we use the same model instance for all steps
|
||||
def get_form_instance(self,step):
|
||||
|
@ -66,10 +74,10 @@ class EvaFormView(CookieWizardView):
|
|||
print(self.instance_dict)
|
||||
for form in form_list:
|
||||
form.save()
|
||||
form_data = [form.cleaned_data for form in form_list]
|
||||
print(form_data)
|
||||
# form_data = [form.cleaned_data for form in form_list]
|
||||
# print(form_data)
|
||||
for dep in MAILS:
|
||||
send_mail_to_department(dep, form_data)
|
||||
send_mail_to_department(dep, self.get_all_cleaned_data())
|
||||
return HttpResponseRedirect('success')
|
||||
|
||||
# return super().form_valid(form)
|
||||
|
|
Loading…
Reference in New Issue