作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我使用 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/' })
关于Django reset_password_confirm TemplateSyntaxError问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4790838/
当我使用 django.contrib.auth.views.password_reset_confirm 完全没有参数它可以工作,我可以毫无问题地渲染模板,当添加 uidb36 和 token 参数
我是一名优秀的程序员,十分优秀!