Skip to content

Instantly share code, notes, and snippets.

@pistatium
Created August 20, 2014 09:29
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 pistatium/9bf24d49ea294578224a to your computer and use it in GitHub Desktop.
Save pistatium/9bf24d49ea294578224a to your computer and use it in GitHub Desktop.
WTForm with bootstrap
{% for field in form %}
<div class="form-group {{funcs["yesno"](field.errors,"has-error")}}">
<label for="{{field.label.field_id}}" class="col-sm-2 control-label">{{field.label.text}}</label>
<div class="col-sm-10">
{% raw field(class_="form-control") %}
{% if field.description %}
<span class="help-block">{{ field.description}}</span>
{% end %}
{% if field.errors %}
<span class="help-block">
{% for err in field.errors %}
{{err}}
{% end %}
</span>
{% end %}
</div>
</div>
{% end %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment