2

リンクがあります

 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.

原因を見つけるのにどのように役立ちますか?

4

2 に答える 2

5

あなたのパターンは間違っています、そうあるべきです

r'editYou/(?P<costumerSlug>.*)/$'
#         ^^^^
#   not   <?P(costumerSlug>.*)
于 2013-04-19T07:56:53.717 に答える
2

次のように URL に名前を付ける方がよい場合があります。

(r'editYou/(?P<costumerSlug>.*)/$', 'editYou', name="edit"),

次に、テンプレートで次を使用できます。

 a href="{% url edit costumer.slug %}"
于 2013-04-19T07:56:46.187 に答える