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

wizard finally working (proof of conecpt)

This commit is contained in:
Benni Bärmann 2021-01-13 09:51:13 +01:00
parent 659c7f3d34
commit 390606e3d5
1 changed files with 14 additions and 3 deletions

View File

@ -45,18 +45,29 @@ def send_mail_to_department(department, data):
class EvaFormView(CookieWizardView):
model = Employee
# model = Employee
template_name = 'evapp/employee_form.html'
form_list = [PersonalForm, WorkingForm]
instance = None
# form_class = EmployeeForm
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):
if self.instance == None:
self.instance = Employee()
return self.instance
def done(self, form_list, **kwargs):
# self.model.save()
# form = form_list[0] #.save()
print ('INSTANCE_DICT')
print(self.instance_dict)
for form in form_list:
form.save()
form_data = [form.cleaned_data for form in form_list]
print(form_data)
for dep in MAILS:
send_mail_to_department(dep, form_data)
return render(self.request, 'evapp/dataloop.txt', {