I am currently using the forms in django.contrib.auth to change a user password, but i would like to customize the validation messages without editing the django/contrib/auth/forms.py file
Anyone got any pointers? Would help me a lot!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
(Updated according to the comment – the same principle still applies: subclass the form and override.)
Subclass the form and override the clean method for the particular field:
… then use
MyPasswordChangeForminstead of PasswordChangeForm in your views.