From c08abc2685a9aacc1f1fe586ba566e88e43891bd Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Mon, 31 Oct 2022 22:03:53 +0100 Subject: [PATCH] Use django-bootstrap for forms --- .idea/charasheet.iml | 1 + poetry.lock | 17 ++++++++++++++++- pyproject.toml | 1 + .../templates/character/notes_update.html | 4 ++-- src/charasheet/settings.py | 1 + src/common/templates/common/base.html | 3 +-- .../django_registration/registration_form.html | 5 +++-- src/common/templates/registration/login.html | 6 ++++-- 8 files changed, 29 insertions(+), 9 deletions(-) diff --git a/.idea/charasheet.iml b/.idea/charasheet.iml index f73b0e7..391aeba 100644 --- a/.idea/charasheet.iml +++ b/.idea/charasheet.iml @@ -28,6 +28,7 @@ diff --git a/poetry.lock b/poetry.lock index cf2f377..b327476 100644 --- a/poetry.lock +++ b/poetry.lock @@ -222,6 +222,17 @@ amazon_ses = ["boto3"] dev = ["flake8", "sphinx", "sphinx-rtd-theme", "tox", "twine", "wheel"] postal = ["cryptography"] +[[package]] +name = "django-bootstrap5" +version = "22.1" +description = "Bootstrap 5 for Django" +category = "main" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +Django = ">=3.2" + [[package]] name = "django-browser-reload" version = "1.6.0" @@ -956,7 +967,7 @@ h11 = ">=0.9.0,<1" [metadata] lock-version = "1.1" python-versions = ">=3.10.0, <4" -content-hash = "2005841e057ea97d65b1582d1454765504d5146e98ffe5e2023e694ef093f6a4" +content-hash = "d112838252717a7085bcb8eb5b1893d98cb99d0e708791e5d4e2b0ada7341a9f" [metadata.files] ansicon = [ @@ -1178,6 +1189,10 @@ django-anymail = [ {file = "django-anymail-8.6.tar.gz", hash = "sha256:783342d49dd07d68778b81dd12a94c86e1d217463a68a85450a0513fabe31345"}, {file = "django_anymail-8.6-py3-none-any.whl", hash = "sha256:49d83d7c16316ca86a624097496881d59b7d71b16bf1c5211cffa5b19ef98d0c"}, ] +django-bootstrap5 = [ + {file = "django-bootstrap5-22.1.tar.gz", hash = "sha256:70b51f020ef95a64780a0b5d5fdb1fade6e7b5e26c53355cc4f3648eca239cab"}, + {file = "django_bootstrap5-22.1-py3-none-any.whl", hash = "sha256:cf3f257abf750f19e47eddc106066ddb182576185494965d1408eddcb3a7380b"}, +] django-browser-reload = [ {file = "django-browser-reload-1.6.0.tar.gz", hash = "sha256:9ca69c71796f53868bdc7421f120d147f7a64faa0d5d8c06970ba3f8061af63c"}, {file = "django_browser_reload-1.6.0-py3-none-any.whl", hash = "sha256:31b8b2d51e8faa5878f21e6b60b8f43e1123907c6e082e9e967962ba63958829"}, diff --git a/pyproject.toml b/pyproject.toml index a1ec93a..9534e97 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,7 @@ selenium = ">=4.5.0" Markdown = ">=3.2" django-registration = ">=3.3" django-anymail = {extras = ["mailgun"], version = ">=8.6"} +django-bootstrap5 = ">=22.1" [tool.poetry.dev-dependencies] django-debug-toolbar = ">=3.2" diff --git a/src/character/templates/character/notes_update.html b/src/character/templates/character/notes_update.html index 5a9de5b..8f977b1 100644 --- a/src/character/templates/character/notes_update.html +++ b/src/character/templates/character/notes_update.html @@ -1,6 +1,6 @@
-

+

Notes Save -

+ {% csrf_token %}
diff --git a/src/charasheet/settings.py b/src/charasheet/settings.py index e01498e..3490f5a 100644 --- a/src/charasheet/settings.py +++ b/src/charasheet/settings.py @@ -63,6 +63,7 @@ EXTERNAL_APPS = [ "django_linear_migrations", "django_extensions", "django_htmx", + "django_bootstrap5", "django_cleanup.apps.CleanupConfig", # should be last: https://pypi.org/project/django-cleanup/ ] if DEBUG_TOOLBAR: diff --git a/src/common/templates/common/base.html b/src/common/templates/common/base.html index 5eec256..57cf432 100644 --- a/src/common/templates/common/base.html +++ b/src/common/templates/common/base.html @@ -18,12 +18,11 @@ -
+
{% if user.is_authenticated %} Déconnexion {% endif %} {% block content %} - {% include "common/hello-random.html" %} {% endblock %}
diff --git a/src/common/templates/django_registration/registration_form.html b/src/common/templates/django_registration/registration_form.html index b79105e..14bb44a 100644 --- a/src/common/templates/django_registration/registration_form.html +++ b/src/common/templates/django_registration/registration_form.html @@ -1,10 +1,11 @@ {% extends "common/base.html" %} +{% load django_bootstrap5 %} {% block content %}

Inscription

- {{ form.as_p }} {% csrf_token %} - + {% bootstrap_form form %} + {% bootstrap_button button_type="submit" content="S'inscrire" %}
{% endblock %} diff --git a/src/common/templates/registration/login.html b/src/common/templates/registration/login.html index 18271a5..10b0b7a 100644 --- a/src/common/templates/registration/login.html +++ b/src/common/templates/registration/login.html @@ -1,11 +1,13 @@ {% extends "common/base.html" %} +{% load django_bootstrap5 %} {% block content %}

Connexion

- {{ form.as_p }} + {% csrf_token %} - + {% bootstrap_form form %} + {% bootstrap_button button_type="submit" content="Connexion" %} Create account