Skip to content

Commit

Permalink
Fixed add_bootstrap_class template filter
Browse files Browse the repository at this point in the history
Made sure that the add_bootstrap_class filter correctly obtains the
widget type to prevent it applying the form-control css class onto
parts of forms that shouldn't have it.

Change-Id: I307780b241e70de38e405cbffc4a35859b9aaf1b
Closes-Bug: 1367302
  • Loading branch information
Tehsmash committed Sep 9, 2014
1 parent 29f3782 commit a81a0c1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions horizon/templatetags/form_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def add_bootstrap_class(field):
This is so that Bootstrap styles it properly.
"""
if not isinstance(field, (
django.forms.CheckboxInput,
django.forms.CheckboxSelectMultiple,
django.forms.RadioSelect,
django.forms.FileInput,
if not isinstance(field.field.widget, (
django.forms.widgets.CheckboxInput,
django.forms.widgets.CheckboxSelectMultiple,
django.forms.widgets.RadioSelect,
django.forms.widgets.FileInput,
str,
)):
field_classes = set(field.field.widget.attrs.get('class', '').split())
Expand Down

0 comments on commit a81a0c1

Please sign in to comment.