Skip to content

Instantly share code, notes, and snippets.

@pydanny
Created November 8, 2011 16:33
Show Gist options
  • Save pydanny/1348277 to your computer and use it in GitHub Desktop.
Save pydanny/1348277 to your computer and use it in GitHub Desktop.
django-uni-form + Twitter Bootstrap
<!-- this usually goes in <project-root>/templates/uni_form/field.html -->
{% if field.is_hidden %}
{{ field }}
{% else %}
<div class="clearfix {% if field.errors %}error{% endif %}">
<label for="{{ field.auto_id }}" {% if field.field.required %}class="requiredField"{% endif %}>
{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
</label>
<div class="input">
{{ field }}
{% if field.help_text or field.errors %}
<span class="help-inline">
{% if field.help_text %}
{{ field.help_text|safe }}
{% endif %}
{% for error in field.errors %}
{{ error }}
{% endfor %}
</span>
{% endif %}
</div>
</div>
{% endif %}
@dekomote
Copy link

Forked it with new bootstrap support - https://gist.github.com/1819668

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment