Skip to content

Commit

Permalink
Removed empty class attribute if field class is None (#1208)
Browse files Browse the repository at this point in the history
  • Loading branch information
smithdc1 committed Jan 22, 2022
1 parent 50e83e8 commit e84b43f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crispy_forms/templates/bootstrap4/field.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
{% elif field|is_file and use_custom_control %}
{% include 'bootstrap4/layout/field_file.html' %}
{% else %}
<div class="{{ field_class }}">
<div{% if field_class %} class="{{ field_class }}"{% endif %}>
{% if field|is_select and use_custom_control %}
{% if field.errors %}
{% crispy_field field 'class' 'custom-select is-invalid' %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<form method="post" enctype="multipart/form-data">
<div id="div_id_clearable_file" class="form-group"> <label for="id_clearable_file" class=""> Clearable file </label>
<div class=""> Currently:
<div>Currently:
<a href="something">something</a>
<input type="checkbox" name="clearable_file-clear" id="clearable_file-clear_id">
<label for="clearable_file-clear_id">Clear</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<label for="id_file_field" class=" requiredField"> File field
<span class="asteriskField">*</span>
</label>
<div class="">
<div>
<input type="file" name="file_field" class="fileinput fileUpload form-control-file" required id="id_file_field">
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<form method="post">
<div id="div_id_first_name" class="form-group"> <label for="id_first_name" class=" requiredField"> first name<span
class="asteriskField">*</span> </label>
<div class=""> <input type="text" name="first_name" maxlength="5"
<div> <input type="text" name="first_name" maxlength="5"
class="form-control-lg textinput textInput inputtext form-control" required id="id_first_name"> </div>
</div>
</form>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<form method="post">
<div class="form-group" id="div_id_select"><label class=" requiredField" for="id_select">Select<span
class="asteriskField">*</span></label>
<div class=""><select class="form-control select" id="id_select" name="select">
<div><select class="form-control select" id="id_select" name="select">
<option selected value="1">Option one</option>
<option value="2">Option two</option>
<option value="3">Option three</option>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<form method="post">
<div class="form-group" id="div_id_select"><label class=" requiredField" for="id_select">Select<span
class="asteriskField">*</span></label>
<div class=""><select class="custom-select select" id="id_select" name="select">
<div><select class="custom-select select" id="id_select" name="select">
<option selected value="1">Option one</option>
<option value="2">Option two</option>
<option value="3">Option three</option>
Expand Down

0 comments on commit e84b43f

Please sign in to comment.