using messages for alerts

This commit is contained in:
Matthias 2021-05-15 01:02:25 +02:00
parent 888154e30b
commit f1f75b45cb
2 changed files with 16 additions and 0 deletions

View File

@ -21,6 +21,7 @@ from datetime import datetime
import yaml import yaml
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.contrib.messages import constants as messages
def _is_true(x): def _is_true(x):
@ -593,3 +594,9 @@ IMPORT_EXPORT_USE_TRANSACTIONS = True
INTERNAL_IPS = [ INTERNAL_IPS = [
'127.0.0.1', '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',
}

View File

@ -8,6 +8,15 @@
{% block content %} {% block content %}
{% if messages %}
{% for message in messages %}
<div class='{{ message.tags }}'>
{{ message|safe }}
</div>
{% endfor %}
{% endif %}
<div class='panel panel-default panel-inventree'> <div class='panel panel-default panel-inventree'>
<div class='row'> <div class='row'>
<div class='col-sm-6'> <div class='col-sm-6'>