0

我在我的应用程序的 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,但如果我注释掉该字符串,站点仍然可以正常运行。

PS我需要命名它以从购物车中获取重定向并继续用户结帐。

4

1 回答 1

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

于 2012-08-23T18:41:42.960 回答