我正在尝试使用表单向导来使用不同的模板名称,但我收到一个错误,我不明白为什么它看起来很简单。
视图.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/')