我正在使用Django 2.1,并且已经使用过UserCreationForm 像这样的更新表格:
class UserUpdateForm(UserCreationForm):
email = forms.EmailField()
class Meta:
model = User
fields = ['username','email']
但是当我在模板中使用此表单时,会看到额外的密码字段 而且我不希望这两个密码字段
如果有帮助,我也将此类用作A注册类
class UserRegisterForm(UserCreationForm):
email = forms.EmailField()
class Meta:
model = User
fields = ['username','email','password1','password2']
}