wizard finally working (proof of conecpt)
This commit is contained in:
parent
659c7f3d34
commit
390606e3d5
|
@ -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', {
|
||||
|
|
Loading…
Reference in New Issue