diff --git a/.gitignore b/.gitignore index cfdaa5b..9ea5d28 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ docs/_build /build /dist + +>>>>>>> aee2b719b27498f1b3dcbb1909a8443ff6d1cf9f diff --git a/bootstrapform/templates/bootstrapform/field.html b/bootstrapform/templates/bootstrapform/field.html index 8150352..bfbdf64 100644 --- a/bootstrapform/templates/bootstrapform/field.html +++ b/bootstrapform/templates/bootstrapform/field.html @@ -5,12 +5,12 @@
{% if field.auto_id %} - + {% endif %} {% for error in field.errors %} - {{ error }} + {{ error }} {% endfor %} {% if field.help_text %} @@ -20,9 +20,9 @@ {% endif %}
- {% else %}{% if field|is_radio %} + {% elif field|is_radio %} {% if field.auto_id %} - + {% endif %}
{% for choice in field %} @@ -35,7 +35,7 @@ {% endfor %} {% for error in field.errors %} - {{ error }} + {{ error }} {% endfor %} {% if field.help_text %} @@ -44,16 +44,16 @@

{% endif %}
- {% else %} {% if field.auto_id %} - + {% endif %} -
+ +
{{ field }} {% for error in field.errors %} - {{ error }} + {{ error }} {% endfor %} {% if field.help_text %} @@ -62,5 +62,5 @@

{% endif %}
- {% endif %}{% endif %} + {% endif %}
diff --git a/bootstrapform/templatetags/bootstrap.py b/bootstrapform/templatetags/bootstrap.py index 3ab5aac..8f81796 100644 --- a/bootstrapform/templatetags/bootstrap.py +++ b/bootstrapform/templatetags/bootstrap.py @@ -48,7 +48,8 @@ def bootstrap_horizontal(element, label_cols={}): def add_input_classes(field): - if not is_checkbox(field) and not is_multiple_checkbox(field) and not is_radio(field): + if not is_checkbox(field) and not is_multiple_checkbox(field) and not is_radio(field) \ + and not is_file(field): field_classes = field.field.widget.attrs.get('class', '') field_classes += ' form-control' field.field.widget.attrs['class'] = field_classes @@ -93,3 +94,8 @@ def is_multiple_checkbox(field): @register.filter def is_radio(field): return field.field.widget.__class__.__name__.lower() == "radioselect" + + +@register.filter +def is_file(field): + return field.field.widget.__class__.__name__.lower() == "clearablefileinput" diff --git a/example/app/templates/index.html b/example/app/templates/index.html index 76527e7..b539d26 100644 --- a/example/app/templates/index.html +++ b/example/app/templates/index.html @@ -6,6 +6,12 @@ Bootstrap form example +