Browse Source

conditional form intermediate versionnot working version

master
Benni Baermann 4 years ago
parent
commit
5d8525671c
1 changed files with 18 additions and 6 deletions
  1. +18
    -6
      input/views.py

+ 18
- 6
input/views.py View File

@ -34,12 +34,24 @@ class ExternView(CookieWizardView):
template_name = "input/extern.html" template_name = "input/extern.html"
form_list = [VolunteerForm, LibraryForm] 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): def done(self, form_list, **kwargs):
print('ExternView.done() reached') print('ExternView.done() reached')

Loading…
Cancel
Save