Skip to content

Commit 8e6d278

Browse files
JimiRecardsmithdc1
authored andcommitted
Fixed classes for Row layout object
Class "form-row" is replaced by "row" in bootstrap 5.
1 parent d96af32 commit 8e6d278

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<div {% if div.css_id %}id="{{ div.css_id }}"{% endif %} class="form-row {{ div.css_class|default:'' }}" {{ div.flat_attrs|safe }}>
2-
{{ fields|safe }}
1+
<div {% if div.css_id %}id="{{ div.css_id }}"{% endif %} class="row {{ div.css_class|default:'' }}" {{ div.flat_attrs|safe }}>
2+
{{ fields|safe }}
33
</div>

tests/results/row.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<form method="post">
2+
<div class="row ">
3+
<div class="col-md ">
4+
<div id="div_id_first_name" class="mb-3"> <label for="id_first_name" class="form-label requiredField"> first
5+
name<span class="asteriskField">*</span> </label>
6+
<div> <input type="text" name="first_name" maxlength="5"
7+
class="textinput textInput inputtext form-control" required id="id_first_name"> </div>
8+
</div>
9+
</div>
10+
<div class="col-md ">
11+
<div id="div_id_last_name" class="mb-3"> <label for="id_last_name" class="form-label requiredField"> last
12+
name<span class="asteriskField">*</span> </label>
13+
<div> <input type="text" name="last_name" maxlength="5"
14+
class="textinput textInput inputtext form-control" required id="id_last_name"> </div>
15+
</div>
16+
</div>
17+
</div>
18+
</form>

tests/test_layout.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def test_layout_fieldset_row_html_with_unicode_fieldnames(settings):
195195
assert 'id="row_passwords"' in html
196196
assert html.count("<label") == 6
197197

198-
assert 'class="form-row rows"' in html
198+
assert 'class="row rows"' in html
199199

200200
assert "Hello!" in html
201201
assert "testLink" in html
@@ -550,3 +550,15 @@ def test_file_field():
550550
'<input type="file" name="file_field" class="fileinput fileUpload '
551551
'form-control" required id="id_file_field">' in html
552552
)
553+
554+
555+
def test_row():
556+
form = SampleForm()
557+
form.helper = FormHelper()
558+
form.helper.layout = Layout(
559+
Row(
560+
Column("first_name"),
561+
Column("last_name"),
562+
)
563+
)
564+
assert parse_form(form) == parse_expected("row.html")

0 commit comments

Comments
 (0)