Python Django Url正则表达式NoReverseMatch错误

Python Django Url正则表达式NoReverseMatch错误,python,html,regex,django,Python,Html,Regex,Django,有这样一个html,我想在按下url时向函数传递2个参数: htmlpage {% for n in notifications %} <li style="..."><b>{{ n.title }}</b> - {{ n.description }} <a href="{% url 'update-notify-status' n.id n.title %}" >Do

有这样一个html,我想在按下url时向函数传递2个参数:

htmlpage

{% for n in notifications %}
                    <li style="..."><b>{{ n.title }}</b> - {{ n.description }}
                    <a href="{% url 'update-notify-status' n.id n.title %}" >Don't show again</a>
{% endfor %}
views.py

def updateStatus(request,noteId,noteTile):
q=History.objects.filter(notification_id=noteId,title=noteTile).order_by('-id')[0]
当我启动程序时,它给出一个错误“NoReverseMatch”。 我将遵循以下示例:


url章节的反向解析

我打赌
n.id
n.title
都不匹配
([0-9]{4})

您应该更新url模式以处理任何可能的
id
title

比如:

r'^notification_htmlv2/update_status/([0-9]+)/([a-zA-Z0-9]+)$'

n、 title可能是一个字符串,它不能与([0-9]{4})匹配,您需要这样的内容:[\w-]+我添加了您建议的内容,但仍然会给出错误<代码>未找到参数为“(4L,u'EUW')且关键字参数为“{}”的“更新通知状态”的反转。1个模式已尝试:['notification_htmlv2/update_status/([0-9]{4})/([a-zA-Z0-9]+)$”@Zecarlos您尚未替换
id
的模式(您仍然有
([0-9]{4})
,我建议
([0-9]+)
),
{4}
表示它只匹配长度4,您的
id
的长度为1。
+
表示匹配一个或多个字符。现在我明白了,谢谢
r'^notification_htmlv2/update_status/([0-9]+)/([a-zA-Z0-9]+)$'