Skip to content

Instantly share code, notes, and snippets.

@bchhun
Created October 16, 2013 01:22
Show Gist options
  • Save bchhun/7001226 to your computer and use it in GitHub Desktop.
Save bchhun/7001226 to your computer and use it in GitHub Desktop.
Twitter Bootstrapped Django Form
<div class="control-group two-columns {% if field.errors %}warning{% endif %}">
<label
class="control-label {% if field.field.required %}bold{% endif %}"
for="{{ field.auto_id }}">
{{ field.label|safe }}
{{ field.required }}
</label>
<div class="controls">
{{ field }}
{% if field.errors %}
{{ field.errors }}
{% endif %}
</div>
</div>
{% extends 'base.html' %}
{% block main %}
<h1>Tasting</h1>
<form action="{% url 'corewine:tasting' %}" class="form-horizontal" method="post" role="form">
{% csrf_token %}
{% for field in form %}
{% include "form_field.html" with field=field %}
{% endfor %}
<button type="submit" class="btn btn-default">Submit</button>
</form>
{% endblock main %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment