Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify row template to class "row" #36

Merged
merged 2 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG FOR CRISPY-BOOTSTRAP5

## 0.3.1(2021-03-03)
* Fixed classes for `row` layout object (#36)

See [Milestones](https://github.com/django-crispy-forms/crispy-bootstrap5/milestone/4?closed=1) for full changelog.

## 0.3 (2021-02-21)
* Fixed rendering of select widgets (#31)

Expand Down
4 changes: 2 additions & 2 deletions crispy_bootstrap5/templates/bootstrap5/layout/row.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div {% if div.css_id %}id="{{ div.css_id }}"{% endif %} class="form-row {{ div.css_class|default:'' }}" {{ div.flat_attrs|safe }}>
{{ fields|safe }}
<div {% if div.css_id %}id="{{ div.css_id }}"{% endif %} class="row {{ div.css_class|default:'' }}" {{ div.flat_attrs|safe }}>
{{ fields|safe }}
</div>
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from setuptools import setup

VERSION = "0.3"
VERSION = "0.3.1"


def get_long_description():
Expand Down
18 changes: 18 additions & 0 deletions tests/results/row.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<form method="post">
<div class="row ">
<div class="col-md ">
<div id="div_id_first_name" class="mb-3"> <label for="id_first_name" class="form-label requiredField"> first
name<span class="asteriskField">*</span> </label>
<div> <input type="text" name="first_name" maxlength="5"
class="textinput textInput inputtext form-control" required id="id_first_name"> </div>
</div>
</div>
<div class="col-md ">
<div id="div_id_last_name" class="mb-3"> <label for="id_last_name" class="form-label requiredField"> last
name<span class="asteriskField">*</span> </label>
<div> <input type="text" name="last_name" maxlength="5"
class="textinput textInput inputtext form-control" required id="id_last_name"> </div>
</div>
</div>
</div>
</form>
14 changes: 13 additions & 1 deletion tests/test_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def test_layout_fieldset_row_html_with_unicode_fieldnames(settings):
assert 'id="row_passwords"' in html
assert html.count("<label") == 6

assert 'class="form-row rows"' in html
assert 'class="row rows"' in html

assert "Hello!" in html
assert "testLink" in html
Expand Down Expand Up @@ -550,3 +550,15 @@ def test_file_field():
'<input type="file" name="file_field" class="fileinput fileUpload '
'form-control" required id="id_file_field">' in html
)


def test_row():
form = SampleForm()
form.helper = FormHelper()
form.helper.layout = Layout(
Row(
Column("first_name"),
Column("last_name"),
)
)
assert parse_form(form) == parse_expected("row.html")