我有以下Django的REST API終點Django的模板URL不叫Django的REST API
url(r'^api/email-verification/(?P<pk>[0-9]+)/$', EmailVerificationApiView.as_view(), name="email-verified")
和下面是我在哪裏應用此API來驗證用戶,即點擊之後下面Activate
HTML模板鏈接,上面提到的API端點將被調用,並在後端用戶將flaged驗證,但與點擊的HTML按鈕,它不會調用API。
<body>
<tr>
<td class="button">
<div><!--[if mso]>
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="http://" style="height:45px;v-text-anchor:middle;width:155px;" arcsize="15%" strokecolor="#ffffff" fillcolor="#ff6f6f">
<w:anchorlock/>
<center style="color:#ffffff;font-family:Helvetica, Arial, sans-serif;font-size:14px;font-weight:regular;">My Account</center>
</v:roundrect>
<a href="{% url 'email-verified' user_id %}">
Activate
</a>
</div>
</td>
</tr>
<body>
點擊Actvate
按鈕後,它重定向我另一個頁面這給下面的語句
Redirect Notice
The page you were on is trying to send you to an invalid URL (http:///api/email-verification/103/).
If you do not want to visit that page, you can return to the previous page.
。我是在Django相對較新,Django的休息api.Is有沒有其他特殊的方式來調用Django休息api在Django的模板url標籤?
在提,API是一個POST API和上面給出的HTML模板是一個電子郵件模板。
我想這個答案可能會有所幫助:https://stackoverflow.com/questions/25345392/how-to-add -url-parameters-to-django-template-url-tag –
我更新了我的問題。 – RTan
什麼是''標籤 –
Satendra