0

I am using registration-redux for Django and cannot get the error codes to display inline when the wrong username or password is entered. Oddly enough, if either is left blank, it shows the error message for that. I have left out the password bit to make the example brief.

<form method="post" action="?next={{ next|default:" / " }}" class="form-horizontal">
    {% csrf_token %}
    <div>
        <div>
            <label for="id_username">Username:</label>
            # HERE IS THE BIT THAT IS FAILING {% if form.username.errors %} {{ form.username.errors }} {% endif %} {{ form.username }}
        </div>
    </div>
    ...

Does anyone see problem with what I am doing here? I also had the

{{ form. username.errors }} wrapped in a p tag but it didn't help.

1
  • Try: {{ form.username.errors.0 }} to print the error message. Commented Apr 2, 2017 at 4:25

1 Answer 1

1

Try to add {{ form.non_field_errors }} to the form:

<form method="post" action="?next={{ next|default:"/" }}" class="form-horizontal">
{% csrf_token %}
{{ form.non_field_errors }}
...
Sign up to request clarification or add additional context in comments.

1 Comment

Worked great! Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.