Opened 7 years ago
Last modified 7 years ago
#30163 closed Bug
error_messages password1 'required' can not be overwritten — at Initial Version
| Reported by: | Oskar Haller | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.auth | Version: | 2.1 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
class UserRegisterForm(UserCreationForm):
"""
Form class to register a new user
"""
class Meta:
#https://docs.djangoproject.com/en/2.1/topics/forms/modelforms/#modelforms-overriding-default-fields
model = User
fields = (...'password1', 'password2')
error_messages = {
'password1': {
'required': _('Please enter a password.')
},
'password2': {
'required': _('Please enter a password.')
}
}
Instead of 'Please enter a password' I get 'This field is required.'
For all other fields the overwriting works fine
Note:
See TracTickets
for help on using tickets.