class SignUpForm(UserCreationForm):
class Meta():
model = User
fields = ('username', 'email', 'first_name', 'last_name')
error_messages = {
'last_name': {
'required': _("Please enter your last name."),
},
'first_name': {
'required': _("Please enter your first name."),
},
'password1': {
'required': _("Please enter your first password"),
},
'password2': {
'required': _("Please enter your second password."),
},
}
为什么这种定制不起作用?此外,我不知道为什么发现电子邮件,first_name和last_name不是必填字段。