timonweb / django-bulma

Bulma theme for Django
MIT License
341 stars 58 forks source link

displaying `non_field_errors` when manually building a form #14

Closed benkonrath closed 6 years ago

benkonrath commented 6 years ago

Is there a way to display the non_field_errors when when manually building a form (e.g. {{ form.field|bulma }})? Will this work?:

{% if form.non_field_errors %}
  {{ form.non_field_errors|bulma }}
{% endif %}

Thanks!

benkonrath commented 6 years ago

That doesn't work (of course) but adding this does:

{% if form.non_field_errors %}
  <div class="message is-danger">
    <div class="message-body">
      {% for non_field_error in form.non_field_errors %}
        {{ non_field_error }}
      {% endfor %}
    </div>
  </div>
{% endif %}