I looked at the documentation, and I'm not quite sure how to use different templates for each step ...
I looked at the source code and it seems that the template name is hard-coded:
class WizardView(TemplateView):
"""
The WizardView is used to create multi-page forms and handles all the
storage and validation stuff. The wizard is based on Django generic
class based views.
"""
storage_name = None
form_list = None
initial_dict = None
instance_dict = None
condition_dict = None
template_name = 'formtools/wizard/wizard_form.html'
...........
The docs say something about mixins, but I'm not sure how to use them since I just started with django ...
thank
UPDATE:
I looked further into the source code and realized that there was a method get_template_names.
I tried:
class AddWizard(SessionWizardView):
def get_template_names(self, step):
if step == 0:
return 'business/add1.html'
return 'business/add2.html'
def done(self, form_list, **kwargs):
return render_to_response('business/done.html', {
'form_data': [form.cleaned_data for form in form_list],
})
But the error turned out:
get_template_names() takes exactly 2 arguments (1 given)
source
share