gpt4 book ai didi

Django reset_password_confirm TemplateSyntaxError问题

转载 作者:行者123 更新时间:2023-12-03 13:45:12 24 4
gpt4 key购买 nike

当我使用 django.contrib.auth.views.password_reset_confirm 完全没有参数它可以工作,我可以毫无问题地渲染模板,当添加 uidb36 和 token 参数时它会失败。

渲染时捕获 NoReverseMatch:“django.contrib.auth.views.password_reset_confirm”的反向参数“()”和关键字参数“{'uidb36':'111','token':'1111111111111'}'未找到。

最佳答案

很可能是您的 urls.py 有问题。您需要设置正确的模式来获取作为 URL 参数传递的 uidb36 和 token 值。如果不是,它将引发与您在上面看到的类似的错误。

就像是:

(r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm', {'template_name' : 'registration/password_reset.html',  'post_reset_redirect': '/logout/' })

registration/password_reset.html - 是我的自定义模板

注销 - 是我的自定义注销操作

关于Django reset_password_confirm TemplateSyntaxError问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4790838/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com