I have this code in my login form.
 {% for field in login_form %}
  <p>{{ field }}</p>
  {% if field.errors %}
   <p class="text-danger">{{ field.errors.as_text|cut:"* "|escape }}</p>
  {% endif %} 
 {% endfor %}

The user must enter a valid email address in the "username" field. If the 
user enters a string not formatted like an email, I'll see this error in 
the `p` tag: "Enter a valid email address."

But if the user enters a bad email/password combo, nothing shows up. In my 
`views.py`, I have a section that looks something like
if login_form.is_valid:
  ...
else:
  print login_form.errors 

Here's what Django prints to console. "<ul class="errorlist"><li>__all__<ul 
class="errorlist nonfield"><li>Please enter a correct username and 
password. Note that both fields may be case-sensitive.</li></ul></li></ul>"

Why does the error print to console but not into my `p` tag?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f4dfcfa5-c687-439e-9e3a-8cb6f0b2c826%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to