diff --git a/config/settings.py b/config/settings.py index d01178e..9c9e2c2 100644 --- a/config/settings.py +++ b/config/settings.py @@ -48,6 +48,7 @@ DJANGO_APPS = [ # Third party apps THIRD_PARTY_APPS = [ "crispy_forms", + "crispy_bootstrap5", "rest_framework", "django_filters", ] @@ -196,7 +197,8 @@ EMAIL_HOST_USER = config("USER_EMAIL") EMAIL_HOST_PASSWORD = config("USER_PASSWORD") # crispy config -CRISPY_TEMPLATE_PACK = "bootstrap4" +CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5" +CRISPY_TEMPLATE_PACK = "bootstrap5" LOGIN_REDIRECT_URL = "/" LOGOUT_REDIRECT_URL = "/" diff --git a/templates/core/post_add.html b/templates/core/post_add.html index e909ae7..4f11f7c 100644 --- a/templates/core/post_add.html +++ b/templates/core/post_add.html @@ -12,29 +12,17 @@ -{% if messages %} - {% for message in messages %} - {% if message.tags == 'error' %} -
- {{ message }} -
- {% else %} -
- {{ message }} -
- {% endif %} - {% endfor %} -{% endif %} +{% include 'snippets/messages.html' %}
-
-

Item Post & Update Form

-

+
+

Post Form

+
{% csrf_token %} {{ form|crispy }} - - Cancel + + Cancel
diff --git a/templates/snippets/messages.html b/templates/snippets/messages.html new file mode 100644 index 0000000..47af087 --- /dev/null +++ b/templates/snippets/messages.html @@ -0,0 +1,14 @@ + +{% if messages %} + {% for message in messages %} + {% if message.tags == 'error' %} +
+ {{ message }} +
+ {% else %} +
+ {{ message }} +
+ {% endif %} + {% endfor %} +{% endif %}