class LoginForm(forms.Form):
nickname = forms.CharField(max_length=100)
username = forms.CharField(max_length=100)
password = forms.CharField(widget=forms.PasswordInput)
class LoginFormWithoutNickname(LoginForm):
# i don't want the field nickname here
nickname = None #??
有没有一种方法可以实现这个?
注意:我没有一个ModelForm
,所以使用exclude
的Meta
类是不起作用的。
__init__(self)
编辑为__init__(self, *args, **kwargs)
。 - apelliciari