简体   繁体   English

路径已弃用(django.contrib.auth.views.password_reset_confirm)

[英]path is deprecated (django.contrib.auth.views.password_reset_confirm)

I am working on password reset on django project, when the email address is sent i get 我正在django项目上重置密码,当发送电子邮件地址时我得到

path is deprecated (django.contrib.auth.views.password_reset_confirm)

at the command prompt. 在命令提示符下。

Here is my url.py 这是我的url.py

from django.conf.urls import patterns, include, url
from django.contrib import admin
from doreenselly import views
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.auth.views import password_reset, password_reset_done, password_reset_confirm, password_reset_complete
from django.views.generic import TemplateView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', 'selly.views.index', name="index"),
    url(r'^selly/', include('selly.urls')),
    url(r'^delete_item/(?P<item_id>[-\w]+)/$', views.delete_item, name='delete_item'),
    url(r'^admin_delete_item/(?P<item_id>[-\w]+)/$', views.admin_delete_item, name='admin_delete_item'),

    # Password reset urls
    url(r'^reset/form/$', TemplateView.as_view(template_name = 'registration/password_reset_email.html')),
    url(r'^resetpassword/passwordsent/$', password_reset_done, name="password_reset_done"),
    url(r'^reset/password/$', password_reset, name="password_reset"),
    url(r'^reset/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', password_reset_confirm, name="password_reset_confirm"),
    url(r'^reset/done/$', password_reset_complete, name="password_reset_complete"),
]

Your urls look OK, so my guess is the problem is in your template. 您的网址看起来不错,所以我想问题出在您的模板中。

Look for 寻找

{% url 'django.contrib.auth.views.password_reset_confirm' uidb64=uid token=token %}

in your registration/password_reset_email.html template, and replace it with 在您的registration/password_reset_email.html模板中,并将其替换为

{% url 'password_reset_confirm' uidb64=uid token=token %}

If that doesn't solve the problem, then you need to find out where the warning is coming from. 如果那不能解决问题,那么您需要找出警告的来源。 You can run the dev server with the -W flag to turn warnings into exceptions . 您可以使用-W标志运行dev服务器,以将警告变为异常

python -W error manage.py runserver

When you send the password reset email, you will get a traceback which will show you where the problem is. 当您发送密码重置电子邮件时,您将得到一个回溯,它将向您显示问题出在哪里。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 NoReverseMatch:反向为``django.contrib.auth.views.password_reset_confirm&#39;&#39; - NoReverseMatch: Reverse for ''django.contrib.auth.views.password_reset_confirm'' 为什么django 1.6在contrib.auth.views.password_reset_confirm视图上将“ form”设置为“ none”? - Why is django 1.6 setting “form” to “none” on the contrib.auth.views.password_reset_confirm view? password_reset行185中的&#39;str&#39;对象不可调用/django/contrib/auth/views.py - 'str' object is not callable /django/contrib/auth/views.py in password_reset, line 185 “AttributeError: module 'django.contrib.auth.views' has no attribute 'password_reset'” urls.py 中的错误 - “AttributeError: module 'django.contrib.auth.views' has no attribute 'password_reset' ” error in urls.py 贡献验证重置密码错误 - Contrib Auth Reset Password Error Django (v3.1) PASSWORD RESET LINK: AssertionError at line 260 of django/contrib/auth/views.py assert 'uidb64' in kwargs and 'token' in kwargs - Django (v3.1) PASSWORD RESET LINK: AssertionError at line 260 of django/contrib/auth/views.py assert 'uidb64' in kwargs and 'token' in kwargs Django内置了用于密码重置的身份验证视图-表单未显示 - Django built in auth views for password reset - Form not showing 带有django.contrib.auth.views.login的TemplateSyntaxError - TemplateSyntaxError with django.contrib.auth.views.login django.contrib.auth.views的login()和logout() - login() and logout() of django.contrib.auth.views 如何在Django中更改contrib.auth.views.password_change视图文本? - How to change contrib.auth.views.password_change view texts in Django?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM