conditional forms finally working
This commit is contained in:
parent
5d8525671c
commit
c69fdb0e5b
|
@ -42,15 +42,23 @@ class ExternView(CookieWizardView):
|
||||||
# return self.get_form_step_data(form)
|
# return self.get_form_step_data(form)
|
||||||
|
|
||||||
def get_form(self, step=None, data=None, files=None):
|
def get_form(self, step=None, data=None, files=None):
|
||||||
if step:
|
if step is None:
|
||||||
print ("get_form() step " + step)
|
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':
|
if step == '1':
|
||||||
print('iiiooopppp')
|
prev_data = self.get_cleaned_data_for_step('0')
|
||||||
data = self.get_cleaned_data_for_step('0')
|
if prev_data.get('choice') == 'IFG':
|
||||||
print (data)
|
|
||||||
if data.get('choice') == 'IFG':
|
|
||||||
print ('IFG detected!')
|
print ('IFG detected!')
|
||||||
form = super().get_form(step, data, files)
|
form = IFGForm(data)
|
||||||
|
else:
|
||||||
|
form = LibraryForm(data)
|
||||||
|
else:
|
||||||
|
form = super().get_form(step, data, files)
|
||||||
return form
|
return form
|
||||||
|
|
||||||
def done(self, form_list, **kwargs):
|
def done(self, form_list, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue