From 9309d6773095fb0cbf9d4976eb19241fe0f034fc Mon Sep 17 00:00:00 2001 From: Adrian D'Alessandro Date: Tue, 17 Sep 2024 17:37:28 +0100 Subject: [PATCH 1/3] Install crispy forms and crisp bootstrap --- dune_processes/settings/settings.py | 4 ++++ poetry.lock | 34 ++++++++++++++++++++++++++++- pyproject.toml | 2 ++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/dune_processes/settings/settings.py b/dune_processes/settings/settings.py index 169bace8..1c47f233 100644 --- a/dune_processes/settings/settings.py +++ b/dune_processes/settings/settings.py @@ -136,3 +136,7 @@ INSTALLED_APPS += ["django_bootstrap5"] DJANGO_TABLES2_TEMPLATE = "django_tables2/bootstrap5.html" + +INSTALLED_APPS += ["crispy_forms", "crispy_bootstrap5"] +CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5" +CRISPY_TEMPLATE_PACK = "bootstrap5" diff --git a/poetry.lock b/poetry.lock index 0a8a6eef..d792e119 100644 --- a/poetry.lock +++ b/poetry.lock @@ -171,6 +171,24 @@ files = [ [package.extras] toml = ["tomli"] +[[package]] +name = "crispy-bootstrap5" +version = "2024.2" +description = "Bootstrap5 template pack for django-crispy-forms" +optional = false +python-versions = ">=3.8" +files = [ + {file = "crispy-bootstrap5-2024.2.tar.gz", hash = "sha256:7d1fa40c6faf472e30e85c72551a3d2c9eedbf0abfff920683315e4e6f670f2b"}, + {file = "crispy_bootstrap5-2024.2-py3-none-any.whl", hash = "sha256:3867e320920a6ef156e94f9e0f06a80344c453e1b3bd96cd9dc0522ae9e9afb8"}, +] + +[package.dependencies] +django = ">=4.2" +django-crispy-forms = ">=2" + +[package.extras] +test = ["pytest", "pytest-django"] + [[package]] name = "distlib" version = "0.3.8" @@ -216,6 +234,20 @@ files = [ [package.dependencies] Django = ">=4.2" +[[package]] +name = "django-crispy-forms" +version = "2.3" +description = "Best way to have Django DRY forms" +optional = false +python-versions = ">=3.8" +files = [ + {file = "django_crispy_forms-2.3-py3-none-any.whl", hash = "sha256:efc4c31e5202bbec6af70d383a35e12fc80ea769d464fb0e7fe21768bb138a20"}, + {file = "django_crispy_forms-2.3.tar.gz", hash = "sha256:2db17ae08527201be1273f0df789e5f92819e23dd28fec69cffba7f3762e1a38"}, +] + +[package.dependencies] +django = ">=4.2" + [[package]] name = "django-stubs" version = "5.0.4" @@ -1089,4 +1121,4 @@ brotli = ["brotli"] [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "fe31c0b3c18f9e2201d7dd942661dc7ad7f44f5a0fcb9aa4d359ff1256f6f2e4" +content-hash = "7f1bab17ac1f71ae00794b7356c8a8102b0ac92309a00d3b886191a70c704aa2" diff --git a/pyproject.toml b/pyproject.toml index 4654d470..45de6645 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,8 @@ druncschema = { git = "https://github.com/DUNE-DAQ/druncschema.git" } django-tables2 = "^2.7.0" django-bootstrap5 = "^24.2" pytest-asyncio = "^0.24.0" +django-crispy-forms = "^2.3" +crispy-bootstrap5 = "^2024.2" [tool.poetry.group.dev.dependencies] pytest = "^8.3" From 8562dbeccbb5331f041205c3815796dd944fec31 Mon Sep 17 00:00:00 2001 From: Adrian D'Alessandro Date: Tue, 17 Sep 2024 17:37:46 +0100 Subject: [PATCH 2/3] Use crispy filter on boot process form --- main/templates/main/boot_process.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/templates/main/boot_process.html b/main/templates/main/boot_process.html index c9a527b2..1367af64 100644 --- a/main/templates/main/boot_process.html +++ b/main/templates/main/boot_process.html @@ -1,4 +1,5 @@ {% extends "main/base.html" %} +{% load crispy_forms_tags %} {% block title %}Boot Process{% endblock title %} @@ -6,7 +7,7 @@
{% csrf_token %} - {{ form }} + {{ form|crispy }}
From df3168c609fb297578cc42b95e581d7fea6b5a4c Mon Sep 17 00:00:00 2001 From: Christopher Cave-Ayland Date: Wed, 18 Sep 2024 17:27:58 +0100 Subject: [PATCH 3/3] Apply bootstrap to boot form submit button --- main/templates/main/boot_process.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/templates/main/boot_process.html b/main/templates/main/boot_process.html index 1367af64..8a773728 100644 --- a/main/templates/main/boot_process.html +++ b/main/templates/main/boot_process.html @@ -1,5 +1,6 @@ {% extends "main/base.html" %} {% load crispy_forms_tags %} +{% load django_bootstrap5 %} {% block title %}Boot Process{% endblock title %} @@ -8,7 +9,7 @@
{% csrf_token %} {{ form|crispy }} - + {% bootstrap_button button_type="submit" content="Submit" %}
{% endblock content %}