Skip to content

Instantly share code, notes, and snippets.

@micolous
Created September 14, 2011 06:16
Show Gist options
  • Save micolous/1215965 to your computer and use it in GitHub Desktop.
Save micolous/1215965 to your computer and use it in GitHub Desktop.
Form template for Django for use with twitter-bootstrap
{# Include the hidden fields #}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
{# Include the visible fields #}
{% for field in form.visible_fields %}
<div class="clearfix{% if field.errors %} error{% endif %}">
{{ field.label_tag }}
<div class="input">
{{ field }}
{% if field.errors %}
<span class="help-inline">{{ field.errors }}</span>
{% endif %}
{% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span>
{% endif %}
</div>
</div>
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment