您可以通过覆盖 init 方法来更改子类中的字段:
class LoginFormWithoutNickname(LoginForm): def __init__(self, *args, **kwargs): super(LoginFormWithoutNickname, self).__init__(*args, **kwargs) self.fields.pop('nickname')
您可以通过覆盖 init 方法来更改子类中的字段:
class LoginFormWithoutNickname(LoginForm): def __init__(self, *args, **kwargs): super(LoginFormWithoutNickname, self).__init__(*args, **kwargs) self.fields.pop('nickname')