[Answered ]-Django's UserCreationForm's Errors isn't working?

1👍

According to your comment above ("i want django to show the error messages"[if password is weak in example]), you should add this to your html page (instead than {{form.errors}}).

<div class="error-message">
     {% if form.non_field_errors %} 
                        
        {% for error in form.non_field_errors %}
           <p style="font-size: 13px;">
              {{ error|escape }}
           </p>
       {% endfor %} 
                        
     {% endif %}
 </div>

Form.non_field_errors()
This method returns the list of errors from Form.errors that aren’t associated with a particular field. This includes ValidationErrors that are raised in Form.clean() and errors added using Form.add_error(None, "…").

👤Carlo

0👍

When this error you get then do this:

  1. You must type strong password, which is provided by Django.

password validation rules:

At least 1 digit;
At least 1 uppercase character;
At least 1 lowercase character;
At least 1 special character;

for example:

 Example@4089
  1. This error will come while confirming your password, you must enter correct password in both the fields.

  2. you will face this error if user is already exist.

  3. you must check exists user while creating user, if user exist, this error will come.

Leave a comment