我正在尝试在Django中实现密码重置功能,以下是我的代码:
urls.py
所以,当我们访问网址
请问为什么尽管使用内置视图,它还会报错"NoReversemtach"呢?
urlpatterns = patterns('',
url(r'^signup/$', 'accounts.views.signup', name="signup_email"),
url(r'^user/password/reset/$', 'django.contrib.auth.views.password_reset', {'template_name':'accounts/forgot_password.html',\
'post_reset_redirect' : '/user/password/reset/done/'}, name="reset_password"),
url(r'^user/password/reset/done/$', 'django.contrib.auth.views.password_reset_done'),
forgot_password.html
<form accept-charset="UTF-8" action="{% url 'reset_password' %}" class="reset_pass" id="reset_pass" method="post">
{% csrf_token %}
<div class="control-group">
<label class="control-label" for="user_email" style="font-size: 18px; color: #474747">Email</label>
<div class="controls">
<input class="" id="id_email" name="email" type="text" value="">
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" value="reset_password" class="btn btn-primary">Send me reset password</button>
</div>
</div>
</form>
所以,当我们访问网址
user/password/reset/
时,会显示一个forgot_password.html
页面。当我输入电子邮件并提交表单时,出现以下错误:
还有一个模板渲染错误。
In template /home/user/proj/virtualenvironment/apps/pro_utils/accounts/templates/registration/password_reset_email.html, error at line 7
请问为什么尽管使用内置视图,它还会报错"NoReversemtach"呢?