0
我一直在毆打我的腦袋,一直在解決這個問題。無法將參數從html傳遞到查看函數
我正在使用Django password_reset_confirm
視圖來處理來自用戶的密碼更改請求。
我收到一個錯誤,如screenshot所示。
Reverse mismatch for 'password_reset_confirm'
這是我的HTML呈現形式。
<div>
<h1></h1>
<form id='reset-password-form' action="{% url 'password_reset_confirm' uidb64=uidb64 token=token %}" method="post">
{% csrf_token %}
{{form|foundation }}
{{title}}
{{validlink}}
<div id='submit-button'>
<input type="submit" id='submit-reset-form'>
</div>
</form>
</div>
URL映射是這樣的:
url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',password_reset_confirm, {'set_password_form':ResetPasswordForm,'template_name':'email/password_reset/password_enternew_password.html',}
,name='password_reset_confirm')
可有人告訴我,哪裏是錯誤?
但password_reset_confirm以uidb64和令牌作爲參數,不應該從模板本身傳遞參數嗎? –
根據文檔,password_reset_confirm可以從點擊的鏈接中獲取用戶信息,並給出一個很好的參考鏈接。 –
對不起,我想我以前誤解了你的問題。看到我更新的答案。 – Alasdair