将django form-wizard添加到urls.py后出错

时间:2012-08-23 18:39:47

标签: django django-urls django-formwizard

我在app的urls.py中有这段代码:

urlpatterns = patterns('john_shop.checkout.views',
    (r'^wizard/$', ContactWizard.as_view([CheckoutForm, PaymentForm]),'checkout_wizard'),
)

如果FormWizard保持取消注释,我会收到此错误:

dictionary update sequence element #0 has length 1; 2 is requiredRequest Method:    GET
Request URL:    http://john-shop.ru/category/new-balance-501/
Django Version: 1.4
Exception Type: ValueError
Exception Value:    dictionary update sequence element #0 has length 1; 2 is required
Exception Location: /usr/local/lib/python2.6/dist-packages/Django-1.4-py2.6.egg/django/core/urlresolvers.py in _populate, line 258
Python Executable:  /usr/bin/python
Python Version: 2.6.6

什么可能导致这个问题?我知道Error对urls.py没有任何说明,但是,如果我对该字符串进行评论,那么网站的工作非常完美。

P.S。我需要将其命名为从购物车重定向并让用户完成结帐。

1 个答案:

答案 0 :(得分:0)

你说错了。这是正确的:

urlpatterns = patterns('',
    (r'^ wizard/$', ContactWizard.as_view([CheckoutForm, PaymentForm])),
)

https://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/#hooking-the-wizard-into-a-urlconf