Skip to content

Instantly share code, notes, and snippets.

@jacobh
Created May 31, 2012 12:01
Show Gist options
  • Save jacobh/2842966 to your computer and use it in GitHub Desktop.
Save jacobh/2842966 to your computer and use it in GitHub Desktop.
Twitter Bootstrap Form Mixin for Django Templates
{% for field in form %}
<div class="control-group {% if field.errors %}error{% endif %}">
<label class="control-label" for="{{ field.html_name }}">{{ field.label }}</label>
<div class="controls">
{{ field }}
{% if field.errors %}
<span class="help-inline">{{ field.errors|first }}</span>
{% endif %}
{% if field.help_text %}
<p class="help-block">{{ field.help_text }}</p>
{% endif %}
</div>
</div>
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment