Django, loop over all form errors.

Posted by Hellnar on Stack Overflow See other posts from Stack Overflow or by Hellnar
Published on 2010-03-17T13:26:25Z Indexed on 2010/03/17 13:31 UTC
Read the original article Hit count: 481

Filed under:
|

Hello At my template, I want to iterate through all form errors, including the ones that are NOT bound to field. ( which means for form.errors, it should also display for __all__ errors aswell)

I have tried several versions, Ie:

 <div id="msg">
  {% if form.errors %}
  <div class="error">
   <p><span>ERROR</span></p>
   <ul>
   {% for key,value in form.errors %}
    {% for error in value %}
     <li>{{ error }}</li>
    {% endfor %}
   {% endfor %}
   </ul>
  </div>
  {% endif %}
 </div>

Still no achievement, I will be greatful for any suggestion.

© Stack Overflow or respective owner

Related posts about django

Related posts about django-forms