Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Error 'Reverse for 'password_reset_confirm' not found.' In Django

$
0
0

So, I was trying to build a blog website in which the user can reset his password by sending an email to his email address, I was mostly using Django Build In functionality for that. I was trying to make the confirm URL path in which the user can reset his password but was getting an error even when I included the path for password reset confirm.

Error: Reverse for 'password_reset_confirm' not found. 'password_reset_confirm' is not a valid view function or pattern name.

My urls.py for password-reset

from django.conf.urls import urlfrom django.contrib.auth import views as auth_viewfrom django.urls import pathapp_name = "blog"urlpatterns = [    # for /blog/password-reset/    path('password-reset/', auth_view.PasswordResetView.as_view(template_name='blog/password_reset.html'), name="password_reset"),    # for /blog/password-reset/done/    path('password-reset/done/', auth_view.PasswordResetDoneView.as_view(template_name='blog/password_reset_done.html'), name="password_reset_done"),    # for /blog/password-reset/confirm/<uidb64>/token>    path('password-reset-confirm/<uidb64>/<token>', auth_view.PasswordResetConfirmView.as_view(template_name='blog/password_reset_confirm.html'), name="password_reset_confirm"),] 

Note: I'm not including all the urls cause it's kinda big

My password-reset.html

{% extends 'blog/base_for_log.html' %}{% load  crispy_forms_tags %}{% block title %}Blog{% endblock %}    {% block body %}<div class = "container"><div class="content-section py-5"><form method="POST">                {% csrf_token %}<fieldset class="form-group"><legend class="border-bottom mb-4">                        Password Reset</legend>                    {{ form|crispy }}</fieldset><div class="form-group"><button class="btn btn-outline-info" type = "submit">Request Reset Password</button></div></div></form></div>   </div>{% endblock %}

My blog/password_reset_confirm.html

{% extends "blog/base.html" %}{% load crispy_forms_tags %}{% block body %}<div class="content-section"><form method="POST">            {% csrf_token %}<fieldset class="form-group"><legend class="border-bottom mb-4">Reset Password</legend>                {{ form|crispy }}</fieldset><div class="form-group"><button class="btn btn-outline-info" type="submit">Reset Password</button></div></form></div>{% endblock body %}

I expect the output to be a ConnectionResufedError which but I'm getting a NoReverseMatch Error.

Thanks In Advance.


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>