AssertionError at /Password_changed_succesfully/ No exception message supplied

Я пытаюсь реализовать процесс сброса пароля в django, он работает нормально и меняет пароль, но в конце после ввода нового пароля выдает ошибку, я не знаю почему

файлurls.py:

 """travel URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include
from django.contrib.auth import views as auth_views
urlpatterns = [
    path('admin/', admin.site.urls),
    path('',include('loginpage.urls')),
    path('signup/',include('signup.urls')),
    path('homepage/',include('Homepage.urls')),
    path('password_reset/',auth_views.PasswordResetView.as_view(template_name='loginpage/resetpassword.html'),name='password_reset'),
    path('password_reset_sent/',auth_views.PasswordResetDoneView.as_view(template_name='loginpage/password_resent_sent.html'),name='password_reset_done'),
    path('reset/<uidb64>/<token>/',auth_views.PasswordResetConfirmView.as_view(template_name='loginpage/password_reset_form.html'),name='password_reset_confirm'),
    path('Password_changed_succesfully/',auth_views.PasswordResetConfirmView.as_view(template_name='loginpage/password_reset_done.html'),name='password_reset_complete')
]

resetpassword.html:

    <!DOCTYPE html>
<html>
<head>
{% load static %}
    <title>Reset Password</title>
    <link rel="stylesheet" type="text/css"  href="{% static 'reset.css' %}">
    <link href="https://fonts.googleapis.com/css2?family=Jost:wght@500&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css" />
</head>
<body>
    <div class="right"><img src="{% static 'images/logo2.png' %}" height="400" width="400"></div>
    <div class="main">      
        <input type="checkbox" id="chk" aria-hidden="true">

            <div class="resett">
                <form method="post">
                    {% csrf_token %}
                    {{form}}
                        <input type='submit' name=" Send email">
                </form>
            </div>
    </div>>

</body>
</html>

password_resent_sent.html

<h3>Password reset sent</h3>


<p>We’ve emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly.</p>

<p>If you don’t receive an email, please make sure you’ve entered the address you registered with, and check your spam folder.</p>

password_reset_form.html

    <!DOCTYPE html>
<html>
<head>
{% load static %}
    <title>Reset Password</title>
    <link rel="stylesheet" type="text/css"  href="{% static 'reset2.css' %}">
    <link href="https://fonts.googleapis.com/css2?family=Jost:wght@500&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css" />
</head>
<body>
    <div class="main">      
        <input type="checkbox" id="chk" aria-hidden="true">

            <div class="resett">
                <form method="post">
                    {% csrf_token %}
                    {{form.as_p}}
                        <input type='submit' name="padte password" href='{% url loginpage:check_user %}'>
                </form>
            </div>
    </div>>

</body>
</html>

password_reset_done.html:

<h3>Password reset complete</h3>

<p>Your password has been set. You may go ahead and log in now.</p>

<a href="{% url loginpage:check_user %}">Log in</a>

Ошибка:

Internal Server Error: /Password_changed_succesfully/
Traceback (most recent call last):
  File "C:\Users\admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\handlers\exception.py", line 35, in inner
    response = get_response(request)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\handlers\base.py", line 128, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\handlers\base.py", line 126, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\views\generic\base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\decorators.py", line 62, in _wrapper
    return bound_func(*args, **kwargs)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\views\decorators\debug.py", line 76, in sensitive_post_parameters_wrapper
    return view(request, *args, **kwargs)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\decorators.py", line 58, in bound_func
    return func.__get__(self, type(self))(*args2, **kwargs2)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\decorators.py", line 62, in _wrapper
    return bound_func(*args, **kwargs)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\views\decorators\cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\decorators.py", line 58, in bound_func
    return func.__get__(self, type(self))(*args2, **kwargs2)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\contrib\auth\views.py", line 445, in dispatch
    assert 'uidb64' in kwargs and 'token' in kwargs
AssertionError

В вашем пути Password_changed_successfully у вас есть следующее:

path('Password_changed_succesfully/',auth_views.PasswordResetConfirmView.as_view(template_name='loginpage/password_reset_done.html'),name='password_reset_complete')

Я думаю, что это было слишком энергичное вырезание и вставка из предыдущей строки. Вы хотите auth_views.PasswordChangeDoneView.

path('Password_changed_succesfully/',auth_views.PasswordChangeDoneView.as_view(template_name='loginpage/password_reset_done.html'),name='password_reset_complete')
Вернуться на верх