【发布时间】:2013-07-15 10:24:37
【问题描述】:
我的应用有以下 url 条目:
url(r'^(?P<pk>\d+)/(?P<action>add|edit)/type/$', 'customer.views.edit', name='customer-edit'),
我想用反向发布到这个网址。当我执行以下操作时,我收到错误 NoReverseMatch:
self.client.post(reverse('customer-edit'), {'something:'something'}, follow=True)
这是完整的错误: NoReverseMatch:未找到带有参数“()”和关键字参数“{}”的“客户编辑”的反向。
我需要将 args 或 kwargs 传递给反向吗?如果是这样,它们会是什么样子与上面的 url 匹配?
【问题讨论】:
标签: python regex django http-post django-urls