我是Django的新手,我试图做一个FormWizard。示例工作,但当我在步骤之间移动(不提交)时,表单不会保留或保留已输入的数据。 我怎样才能保持数据的前后移动?
# forms.py
class ContactForm1(forms.Form):
subject = forms.CharField(max_length=100)
class ContactForm2(forms.Form):
sender = forms.CharField(required=False)
class ContactForm3(forms.Form):
message = forms.CharField(widget=forms.Textarea,required=False)
# views.py
class ContactWizard(SessionWizardView):
template_name = "contact_form.html"
def done(self, form_list, **kwargs):
form_data = process_form_data(form_list)
return render_to_response('done.html', {'form_data': form_data})