diff --git a/CHANGELOG.md b/CHANGELOG.md index 514b234..5abc625 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Next Release * Added support for [Switches](https://getbootstrap.com/docs/5.2/forms/checks-radios/#switches). (#162) +* Added modal template ## 2023.10 (2023-10-2023) * Added Django 5.0 and 4.2 support diff --git a/crispy_bootstrap5/templates/bootstrap5/layout/modal.html b/crispy_bootstrap5/templates/bootstrap5/layout/modal.html new file mode 100644 index 0000000..ec2b061 --- /dev/null +++ b/crispy_bootstrap5/templates/bootstrap5/layout/modal.html @@ -0,0 +1,13 @@ + diff --git a/tests/results/modal.html b/tests/results/modal.html new file mode 100644 index 0000000..4aed662 --- /dev/null +++ b/tests/results/modal.html @@ -0,0 +1,15 @@ + diff --git a/tests/test_layout_objects.py b/tests/test_layout_objects.py index 569b734..7432daa 100644 --- a/tests/test_layout_objects.py +++ b/tests/test_layout_objects.py @@ -11,6 +11,7 @@ InlineCheckboxes, InlineField, InlineRadios, + Modal, PrependedAppendedText, PrependedText, StrictButton, @@ -621,3 +622,17 @@ def test_switch_horizontal(self): form.helper.form_class = "form-horizontal" form.helper.layout = Layout(Switch("is_company"), "first_name") assert parse_form(form) == parse_expected("test_switch_horizontal.html") + + def test_modal(self): + test_form = SampleForm() + test_form.helper = FormHelper() + test_form.helper.form_tag = False + test_form.helper.layout = Layout( + Modal( + 'field1', + css_id="modal-id-ex", + css_class="modal-class-ex", + title="This is my modal", + ) + ) + assert parse_form(test_form) == parse_expected("modal.html")