Reputation: 161
I'm trying to use the form wizard for using different template names but I get an error which I don't understand why cause it seem like it is just straight forward.
using different template for each form
views.py
from django.http import HttpResponseRedirect
from django.contrib.formtools.wizard.views import SessionWizardView
FORMS = [("customer", solution.forms.customerForm), //got error undefined variables:solution
("building", solution.forms.buildingForm)]
TEMPLATES = {"customer": "customer.html",
"building": "building.html",
}
class customerWizard(SessionWizardView):
def get_template_names(self):
return [TEMPLATES[self.steps.current]]
def done(self, form_list, **kwargs):
do_something_with_the_form_data(form_list) //get error undefined variables
return HttpResponseRedirect('/page-to-redirect-to-when-done/')
Upvotes: 0
Views: 334
Reputation: 480
from solution import forms *
FORMS = [
("customer", customerForm),
("building", buildingForm)
]
Upvotes: 1