Show Django messages
This commit is contained in:
parent
0c9aae7e66
commit
49bf9465d7
2 changed files with 16 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ https://docs.djangoproject.com/en/2.2/ref/settings/
|
|||
import os
|
||||
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.contrib.messages import constants as messages
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
|
@ -190,6 +191,15 @@ SESSION_COOKIE_AGE = 60 * 60 * 3
|
|||
# Use only one Django Sites
|
||||
SITE_ID = 1
|
||||
|
||||
# Django message
|
||||
MESSAGE_TAGS = {
|
||||
messages.DEBUG: 'alert-secondary',
|
||||
messages.INFO: 'alert-info',
|
||||
messages.SUCCESS: 'alert-success',
|
||||
messages.WARNING: 'alert-warning',
|
||||
messages.ERROR: 'alert-danger',
|
||||
}
|
||||
|
||||
# Allauth configuration
|
||||
ACCOUNT_EMAIL_REQUIRED = True
|
||||
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
|
||||
|
|
|
|||
|
|
@ -87,6 +87,12 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
</nav>
|
||||
|
||||
<main class="container my-3">
|
||||
{% for message in messages %}
|
||||
<div class="alert {{ message.tags }} alert-dismissible" role="alert" >
|
||||
{{ message }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block content %}
|
||||
<p>Default content...</p>
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue