title: Django check form error code in template
body: <p>I am using Django 1.10 and trying to find a way to check the error code of a form inside of the template. So I tried a few things, like errors.as_data or errors.as_json, but I was unable to parse the different values (except by using javascript). Could it be something like this ?</p>
  
  <pre><code>&lt;p&gt;{% for key, value in form.errors.items %}
                      {{ value }}
                      {% if code == 'inactive_account'%}
                           // do some stuff
                      {% endif %}
                  {% endfor %}
  &lt;/p&gt;
  </code></pre>
  
  <p>But I don't know how to get this error code. Any suggestion ?</p>
  
  <p>PS : I know that a solution would be to do it inside of the view, but since I am using a django already-made one, I would prefer not to do it.</p>