Skip to content

Instantly share code, notes, and snippets.

@taiypeo
Created February 22, 2018 12:18
Show Gist options
  • Save taiypeo/3f8da6bede34c93be947845804646eaf to your computer and use it in GitHub Desktop.
Save taiypeo/3f8da6bede34c93be947845804646eaf to your computer and use it in GitHub Desktop.
A Jinja2 macro that prints all of the errors of a WTForms field
{% macro print_errors(field) -%}
{% for err in field.errors %}
<span style="color: red;">[{{ err }}]</span>
{% endfor %}
{%- endmacro %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment