1
0
Fork 0

conditional forms finally working

This commit is contained in:
Benni Bärmann 2020-10-06 09:50:18 +02:00
parent 5d8525671c
commit c69fdb0e5b
1 changed files with 15 additions and 7 deletions

View File

@ -42,14 +42,22 @@ class ExternView(CookieWizardView):
# return self.get_form_step_data(form)
def get_form(self, step=None, data=None, files=None):
if step:
if step is None:
step = self.steps.current
print ("get_form() step " + step)
# prev_data = self.get_cleaned_data_for_step(self.get_prev_step(
# self.steps.current))
# print (data)
if step == '1':
print('iiiooopppp')
data = self.get_cleaned_data_for_step('0')
print (data)
if data.get('choice') == 'IFG':
prev_data = self.get_cleaned_data_for_step('0')
if prev_data.get('choice') == 'IFG':
print ('IFG detected!')
form = IFGForm(data)
else:
form = LibraryForm(data)
else:
form = super().get_form(step, data, files)
return form