{# From: https://wtforms.readthedocs.io/en/2.3.x/specific_problems/#rendering-errors Usage: with_errors(form.field, style='font-weight: bold') #} {% macro with_errors(field) %}
{% if field.errors %} {% set css_class = 'has_error ' + kwargs.pop('class', '') %} {{ field(class=css_class, **kwargs) }} {% else %} {{ field(**kwargs) }} {% endif %}
{% endmacro %}