我正在获得NoReverseMatch
> Reverse for 'production_order_new' with arguments '()' and keyword arguments '{u'quantity': Decimal('444.000'), u'uri':
> 'http://127.0.0.1:8000/production/soproduct/list/', u'pk_bom': 2,
> u'pk_soproduct': 1}' not found. 1 pattern(s) tried:
> ['production/production/order/new/(?P<pk_bom>\\d+)/(?P<pk_soproduct>\\d+)/(?P<uri>\\S+)/(?P<quantity>\\d+(\\.\\d{1,2,3}))/$']
我的网址文件
url(r'^production/order/new/(?P<pk_bom>\d+)/
(?P<pk_soproduct>\d+)/(?P<uri>\S+)/(?P<quantity>\d+(\.\d{1,2,3}))/$',
views.Production_order_new, name="production_order_new"),
和我在模板中的链接
<a href="
{% url 'production_order_new' pk_bom=bom.id
pk_soproduct=soproduct.id uri=request.build_absolute_uri quantity=bom.quantity %}
">PO material</a>
转换为
'{u'quantity': Decimal('444.000'), u'uri':
'http://127.0.0.1:8000/production/soproduct/list/', u'pk_bom': 2,
u'pk_soproduct': 1}'
出于某种原因,它会混淆我认为这是NoReverseMatch的原因。是什么原因以及如何解决?
答案 0 :(得分:1)
网址应更正为:
url(r'^production/order/new/(?P<pk_bom>\d+)/(?P<pk_soproduct>\d+)/(?P<uri>\S+)/(?P<quantity>\d+(\.\d{1,3}))/$',
views.Production_order_new, name="production_order_new"),