Answer the question
In order to leave comments, you need to log in
How to activate Bootstrap 4 notification?
bootstrap has notifications .
How to activate such a notification? The documentation only says how to close it.
Scenario: The user entered data, clicked on the button. The data has been checked and if it is invalid, a notification is called.
Answer the question
In order to leave comments, you need to log in
views:
from django.contrib import messages
if user is not None:
login(request, user)
messages.success(request, 'Вход выполнен')
else:
messages.error(request, "Неправильный логин")
{% for message in messages %}
<div class="alert {{ message.tags }} alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
{{ message }} {{ user.first_name}} {{ user.last_name}}
</div>
{% endfor %}
<div class="col-md-4">
{% include 'AppName/messages.html' %}
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question