Skip to content

Instantly share code, notes, and snippets.

@rguliev
Created August 3, 2017 12:58
Show Gist options
  • Save rguliev/70c59cdc8ad319e30c9d808cdac2041a to your computer and use it in GitHub Desktop.
Save rguliev/70c59cdc8ad319e30c9d808cdac2041a to your computer and use it in GitHub Desktop.
django-uni-form + Twitter Bootstrap
{% if field.is_hidden %}
{{ field }}
{% else %}
<div class="control-group {% if field.errors %}error{% endif %}">
<label for="{{ field.auto_id }}" {% if field.field.required %}class="control-label"{% endif %}>
{% if field.field.required %}<b>{% endif %}{{ field.label|safe }}{% if field.field.required %}*</b>{% endif %}
</label>
<div class="controls">
{{ field }}
{% if field.errors %}
<span class="help-inline">{% for error in field.errors %}{{ error }}<br/> {% endfor %}</span>
{% endif %}
{% if field.help_text%}
<p class="help-block">
{{ field.help_text|safe }}
</p>
{% endif %}
</div>
</div>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment