简体   繁体   中英

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.

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 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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