Skip to content

Instantly share code, notes, and snippets.

@pydanny
Created November 8, 2011 16:33
Show Gist options
  • Star 20 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • 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 %}
@kennethreitz
Copy link

Nice!

@bsnux
Copy link

bsnux commented Nov 9, 2011

Very interesting and useful!!

@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