2024-09-26 18:01:45 发布
网友
我有一个链接
a href="editYou/{{costumer.slug}}"
和URL部分
(r'editYou/<?P(costumerSlug>.*)/$', 'editYou'),
指向方法
def editYou(request, costumerSlug):
但Django显示了一个错误:
The current URL, profile/editYou/es, didn't match any of these.
你怎么帮我找到原因?你知道吗
你的模式是错误的,应该是
r'editYou/(?P<costumerSlug>.*)/$' # ^^^^ # not <?P(costumerSlug>.*)
最好将URL命名为:
(r'editYou/(?P<costumerSlug>.*)/$', 'editYou', name="edit"),
然后在模板中,可以使用:
a href="{% url edit costumer.slug %}"
你的模式是错误的,应该是
最好将URL命名为:
然后在模板中,可以使用:
相关问题 更多 >
编程相关推荐