我无法让我的SessionWizardView工作。当我提交最后一步时,向导跳回第一步,不执行done方法。Django SessionWizardView不执行完成方法
views.py
class CvWizardView(CookieWizardView):
form_list = [InfoPersonalForm, PresentacionForm]
template_name = 'postulantes/cv_wizard.html'
def done(self, form_list, **kwargs):
return HttpResponseRedirect(reverse('wizard_done'))
urls.py
url(r'^wizard/$', CvWizardView.as_view() , name="wizard"),
HTML
{% extends "base.html" %}
{% load i18n %}
{% block extra_head %}
{{ wizard.form.media }}
{% endblock %}
{% block content %}
<p>Step {{ wizard.steps.step1 }} of {{ wizard.steps.count }}</p>
<form action="" method="post">{% csrf_token %}
<table>
{{ wizard.management_form }}
{% if wizard.form.forms %}
{{ wizard.form.management_form }}
{% for form in wizard.form.forms %}
{{ form }}
{% endfor %}
{% else %}
{{ wizard.form }}
{% endif %}
</table>
{% if wizard.steps.prev %}
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
{% endif %}
<input type="submit" value="{% trans "submit" %}"/>
</form>
{% endblock %}
谢谢!
你怎么知道'done()'方法没有被调用?什么是'wizard_done'网址? – Rohan 2014-09-30 12:58:17