python - Overriding default error messages in email input widget in django -


i trying override default invalid email error message in django. django doc says, following code should work, it's not. how can adjust it?

class bootstrapauthenticationform(authenticationform): forms.form.error_css_class = 'error' email = forms.emailfield(max_length=254,                             error_messages={'required': 'please enter valid email address.',                                             'invalid': 'please enter valid email address.'},                            widget=forms.emailinput({                                'required': true,                                'class': 'form-control',                                 'placeholder': 'e-mail address',                                })) 

and, error_css_class not working properly: there no change @ all. what's wrong setting?

thanks in advance.

you can use emailvalidator:

email = forms.emailfield(max_length=254, validators=[emailvalidator(message="your message")] 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -