Skip to content

Commit 50e947f

Browse files
committed
1 parent 3092d19 commit 50e947f

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

HISTORY.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ History
66
Develop
77
+++++++
88

9+
* Fix handling of error class (#170)
910
* Remove everything to do with setting HTML `required` attribute (#337)
1011
* Remove everything to do with setting HTML `disabled` attribute (#345)
12+
* No size class for checkboxes (#318, thanks @cybojenix)
1113
* Fix warnings during install (thanks @mfcovington)
1214
* Add subresource integrity to external components (thanks @mfcovington and @Alex131089)
1315

bootstrap3/renderers.py

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,9 @@ def post_widget_render(self, html):
370370

371371
def wrap_widget(self, html):
372372
if isinstance(self.widget, CheckboxInput):
373-
checkbox_class = add_css_class('checkbox', self.get_size_class())
374-
html = '<div class="{klass}">{content}</div>'.format(
375-
klass=checkbox_class,
376-
content=html,
377-
)
373+
# Wrap checkboxes
374+
# Note checkboxes do not get size classes, see #318
375+
html = '<div class="checkbox">{content}</div>'.format(content=html)
378376
return html
379377

380378
def make_input_group(self, html):
@@ -450,20 +448,19 @@ def add_label(self, html):
450448

451449
def get_form_group_class(self):
452450
form_group_class = self.form_group_class
453-
if self.field.errors and self.error_css_class:
454-
form_group_class = add_css_class(
455-
form_group_class, self.error_css_class)
451+
if self.field.errors:
452+
if self.error_css_class:
453+
form_group_class = add_css_class(form_group_class, self.error_css_class)
454+
else:
455+
if self.field.form.is_bound:
456+
form_group_class = add_css_class(form_group_class, self.success_css_class)
456457
if self.field.field.required and self.required_css_class:
457-
form_group_class = add_css_class(
458-
form_group_class, self.required_css_class)
459-
if self.field_errors:
460-
form_group_class = add_css_class(form_group_class, 'has-error')
461-
elif self.field.form.is_bound:
462-
form_group_class = add_css_class(
463-
form_group_class, self.success_css_class)
458+
form_group_class = add_css_class(form_group_class, self.required_css_class)
464459
if self.layout == 'horizontal':
465460
form_group_class = add_css_class(
466-
form_group_class, self.get_size_class(prefix='form-group'))
461+
form_group_class,
462+
self.get_size_class(prefix='form-group')
463+
)
467464
return form_group_class
468465

469466
def wrap_label_and_field(self, html):

0 commit comments

Comments
 (0)