I want to implement password reset functionality on my web page but I am getting NoReverseMatch at /accounts/password_reset/ Reverse for 'password_reset_confirm' not found. 'password_reset_confirm' is not a valid view function or pattern name.
error. please help me to solve this error
url.py Code:
app_name="accounts"
urlpatterns=[
path('password_reset/', auth_views.PasswordResetView.as_view(template_name="password_reset.html",success_url=reverse_lazy('accounts:password_reset_done')), name='password_reset'),
path('password_reset_done/', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'),
path('reset/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view(template_name="password_reset_confirm.html",success_url=reverse_lazy('accounts:password_reset_complete')),
name="password_reset_confirm"),
path('reset_password_complete/',
auth_views.PasswordResetCompleteView.as_view(template_name="password_reset_done.html"), name="password_reset_complete"),
]
passwrd_reset.html
{% extends 'base.html' %}
{% block title %}Password Reset Page{% endblock %}
{% load crispy_forms_tags %}
{% block body %}
<div >
<div >
<div >
<div >
<div >
<h4>Password Reset Page</h4>
<hr>
<div >
Enter email and a mail will be sent with instructions to reset password
</div>
<form method="POST">
{% csrf_token %}
{{ form|crispy }}
<input type="submit" value="Reset Password">
</form>
<hr>
</div>
</div>
</div>
</div>
{% endblock body%}
Additional info about me apps I have two apps one is dashboard and anther is accounts I want to implement this in my accounts app
CodePudding user response:
In your core
app (where you have settings.py
). Go to your urls.py
file and paste:
path('', include('django.contrib.auth.urls'))
Note you have to import include
from django.urls
.
CodePudding user response:
Check your html file names. Is there a password_reset_confirm.html file?