简体   繁体   English

在/ password_reset / django发生TypeError

[英]TypeError at /password_reset/ django

I try to override default password reset template and got this error: 我尝试覆盖默认的密码重置模板,并收到此错误:

TypeError at /password_reset/
__init__() takes 1 positional argument but 2 were given

This is my urls 这是我的网址

   url(r'^password_reset/$', auth_views.PasswordResetView, {'template_name': 'accounts/password_reset_done.html'}, name='password_reset'),

The way you're passing the view to your URL config is wrong. 将视图传递到URL配置的方式是错误的。

Change: 更改:

url(r'^password_reset/$', auth_views.PasswordResetView, ...)

to: 至:

url(r'^password_reset/$', auth_views.PasswordResetView.as_view(template_name='accounts/password_reset_done.html'), ...)

( docs ) docs

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM