Skip to content

Instantly share code, notes, and snippets.

@tioover
Created April 21, 2012 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tioover/2437140 to your computer and use it in GitHub Desktop.
Save tioover/2437140 to your computer and use it in GitHub Desktop.
wtform field maker for jinja2 macro
{% macro field(field, cls='') -%}
<p>{{field.label()}}</p>
<p>{{field(class_ = cls)}}</p>
{%if field.errors%}
<ul class='errors'>
{%for error in field.errors%}
<li class='error'>{{error}}</li>
{%endfor%}
</ul>
{%endif%}
{%- endmacro %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment