Created
July 21, 2014 11:06
-
-
Save richardjpope/30898d24ccaabf77c455 to your computer and use it in GitHub Desktop.
WTForms bootstrap macro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% macro render_field(field) %} | |
<div class="form-group {% if field.errors %}has-error{% endif %}"> | |
{{ field.label(class_="control-label") }} | |
{{ field(class_="form-control", **kwargs)|safe }} | |
{% if field.errors %} | |
{% for error in field.errors %} | |
<span class="help-block">{{error}}</span> | |
{% endfor %} | |
{% endif %} | |
</div> | |
{% endmacro %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment