Opened 6 years ago

Last modified 6 years ago

#30163 closed Bug

error_messages 'password1' 'required' can not be overidden — at Version 2

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 (last modified by Oskar Haller)

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 overrriding works fine

Change History (2)

comment:1 by Oskar Haller, 6 years ago

Type: UncategorizedBug

comment:2 by Oskar Haller, 6 years ago

Description: modified (diff)
Summary: error_messages password1 'required' can not be overwrittenerror_messages 'password1' 'required' can not be overidden
Note: See TracTickets for help on using tickets.
Back to Top