From 5d8525671ca3bdf0d6784bb4b04d549d026928f8 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Mon, 5 Oct 2020 15:53:00 +0200 Subject: [PATCH] conditional form intermediate versionnot working version --- input/views.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/input/views.py b/input/views.py index a117258..0d6b536 100644 --- a/input/views.py +++ b/input/views.py @@ -34,12 +34,24 @@ class ExternView(CookieWizardView): template_name = "input/extern.html" form_list = [VolunteerForm, LibraryForm] - def process_step(self, form): - if form.cleaned_data.get('choice') == 'IFG': - print ('IFG detected!') - self.form_list = [VolunteerForm, IFGForm] - print('leaving process_step()') - return self.get_form_step_data(form) + # def process_step(self, form): + # if form.cleaned_data.get('choice') == 'IFG': + # print ('IFG detected!') + # self.form_list = [VolunteerForm, IFGForm] + # print('leaving process_step()') + # return self.get_form_step_data(form) + + def get_form(self, step=None, data=None, files=None): + if step: + print ("get_form() step " + step) + if step == '1': + print('iiiooopppp') + data = self.get_cleaned_data_for_step('0') + print (data) + if data.get('choice') == 'IFG': + print ('IFG detected!') + form = super().get_form(step, data, files) + return form def done(self, form_list, **kwargs): print('ExternView.done() reached')