So I'm having a hard time figuring out how I can render non field errors 
for both validated and un-validated forms. I have created a templatepack 
and in form.html i do this:

{% load rest_framework %}

{% if form.errors %}
    {% for error in form.errors.non_field_errors %}
        <div class="alert alert-danger" style="width:100%;">{{ error 
}}</div>
    {% endfor %}
{% endif %}
{% for field in form %}
  {% if not field.read_only %}
    {% render_field field style=style %}
  {% endif %}
{% endfor %}


This works for validated forms and I get a proper error message, but when I 
pass it an un-validated form I get an unhandled exception:

You must call `.is_valid()` before accessing `.errors`.


Anyone know of a way to display non field errors for both validated and 
un-validated forms?

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to