0

我正在尝试使用表单向导来使用不同的模板名称,但我收到一个错误,我不明白为什么它看起来很简单。

为每个表格使用不同的模板

视图.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/')
4

1 回答 1

1
from solution import forms *

FORMS = [
    ("customer", customerForm),  
    ("building", buildingForm)
]
于 2013-03-13T15:56:09.103 回答