【发布时间】:2021-10-24 12:49:51
【问题描述】:
我正在编写一个小型应用程序,但在 Django 身份验证框架中使用的密码更改元素遇到了一些问题。但是在更改密码后我总是收到错误消息:找不到'password_change_done'的反向。 'password_change_done' 不是有效的视图函数或模式名称。下面是我的代码:
#account urls.py
from django.urls import path, include
from django.contrib.auth import views as auth_views
from . import views
app_name = 'account'
urlpatterns = [
#Password Changes URLs
path('password_change/', auth_views.PasswordChangeView.as_view(), name='password_change'),
path('password_change/done/', auth_views.PasswordChangeDoneView.as_view(), name='password_change_done'),
]
这是我登录系统的目录结构: Directory Structure
这里是 password_change.html 文件:
<h3 style="text-align: center;">Change your password</h3>
<div class="login-form" style="text-align: center; ">
<form method="post">
{{ form.as_p }}
<p><input type="submit" value="Change"></p>
{% csrf_token %}
</form>
</div>
任何帮助将不胜感激!
【问题讨论】:
标签: html python-3.x django