add initial support for twitter bootstrap 2.0.1

This commit is contained in:
tzangms
2012-02-18 12:33:52 +08:00
parent 45d9917ecb
commit ab849748cc
3 changed files with 16 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
from distutils.version import StrictVersion
VERSION = StrictVersion('0.2.0')
VERSION = StrictVersion('2.0.1')

View File

@@ -7,12 +7,10 @@
{% endfor %}
{% for field in form.visible_fields %}
<div class="clearfix{% if field.errors %} error{% endif %}">
<div class="control-group{% if field.errors %} error{% endif %}">
{% if field|is_checkbox %}
<ul class="inputs-list">
<li>
<div class="input">
<label>
<div class="controls">
<label class="checkbox">
{{ field }} <span>{{ field.label }}</span>
</label>
@@ -21,16 +19,15 @@
{% endfor %}
{% if field.help_text %}
<span class="help-block">
<p class="help-block">
{{ field.help_text }}
</span>
</p>
{% endif %}
</div>
</li>
</ul>
{% else %}
{{ field.label_tag }}
<div class="input">
<div class="control-label">{{ field.label }}</div>
<div class="controls">
{{ field }}
{% for error in field.errors %}
@@ -38,9 +35,9 @@
{% endfor %}
{% if field.help_text %}
<span class="help-block">
<p class="help-block">
{{ field.help_text }}
</span>
</p>
{% endif %}
</div>

View File

@@ -13,3 +13,8 @@ def bootstrap(form):
@register.filter
def is_checkbox(field):
return field.field.widget.__class__.__name__.lower() == "checkboxinput"
@register.filter
def is_radio(field):
return field.field.widget.__class__.__name__.lower() == "radioselect"