From f1f75b45cbc3c9b90718bdc176040f5ccd665dc5 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 15 May 2021 01:02:25 +0200 Subject: [PATCH] using messages for alerts --- InvenTree/InvenTree/settings.py | 7 +++++++ InvenTree/part/templates/part/category.html | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index 7ff90fc7c3..3f9c2d6cec 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -21,6 +21,7 @@ from datetime import datetime import yaml from django.utils.translation import gettext_lazy as _ +from django.contrib.messages import constants as messages def _is_true(x): @@ -593,3 +594,9 @@ IMPORT_EXPORT_USE_TRANSACTIONS = True INTERNAL_IPS = [ '127.0.0.1', ] + +MESSAGE_TAGS = { + messages.SUCCESS: 'alert alert-block alert-success', + messages.ERROR: 'alert alert-block alert-danger', + messages.INFO: 'alert alert-block alert-info', +} diff --git a/InvenTree/part/templates/part/category.html b/InvenTree/part/templates/part/category.html index b79ee0ee60..0b7fbba8f5 100644 --- a/InvenTree/part/templates/part/category.html +++ b/InvenTree/part/templates/part/category.html @@ -8,6 +8,15 @@ {% block content %} +{% if messages %} + {% for message in messages %} +
+ {{ message|safe }} +
+ {% endfor %} +{% endif %} + +