Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个链接
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>.*)
最好将您的网址命名为:
(r'editYou/(?P<costumerSlug>.*)/$', 'editYou', name="edit"),
然后在您的模板中,您可以使用:
a href="{% url edit costumer.slug %}"