Update bootstrap 4 beta error tags to 'is-invalid'
@@ -120,7 +120,7 @@ class CrispyFieldNode(template.Node):
css_class = class_name
if (
- template_pack in ['bootstrap3', 'bootstrap4']
+ template_pack in ['bootstrap3']
and not is_checkbox(field)
and not is_file(field)
and not is_multivalue(field)
@@ -129,6 +129,16 @@ class CrispyFieldNode(template.Node):
if field.errors:
css_class += ' form-control-danger'
+ if (
+ template_pack in ['bootstrap4']
+ and not is_checkbox(field)
+ and not is_file(field)
+ and not is_multivalue(field)
+ ):
+ css_class += ' form-control'
+ if field.errors:
+ css_class += ' is-invalid'
+
widget.attrs['class'] = css_class
# HTML5 required attribute
