如何覆盖PasswordResetConfirmView? (django.contrib.auth.views)

时间:2019-07-28 15:43:18

标签: django django-views django-authentication

我尝试过:

class CustomPasswordResetConfirmView(PasswordResetConfirmView):
    form_class = CustomSetPasswordForm

但它会引发TypeError:__init__() takes 1 positional argument but 2 were given

1 个答案:

答案 0 :(得分:1)

必须使用 init 方法||传递积分的功能

from django.contrib.auth.views import PasswordResetView,PasswordResetConfirmView
class New_PasswordResetConfirmView(PasswordResetConfirmView):
    def __init__(self):
        super(New_PasswordResetConfirmView,self)

https://www.pythonforbeginners.com/super/working-python-super-function