Skip to content

Instantly share code, notes, and snippets.

@davidbgk
Forked from pydanny/field.html
Created November 9, 2011 01:24
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 davidbgk/1350011 to your computer and use it in GitHub Desktop.
Save davidbgk/1350011 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 %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment