messages.info(request, 'Attendance Ready To Be Taken!')
Over here i use django messages to send a string to the user
{% for message in messages %}
{% if message == 'Attendance Ready To Be Taken!' %}
<div class="alert success">
<span class="closebtn">×</span>
<strong>SUCCESS!</strong> {{message}}
</div>
{% else %}
<div class="alert">
<span class="closebtn">×</span>
<strong>WARNING!</strong> {{message}}
</div>
{% endif %}
{% endfor %}
However, although the string is clearly the same..it doesn’t output SUCCESS message.
It can display the message indeed..but I want to filter if it’s a success message to be green..and error message to be red..just for user interface to warn users
.alert {
padding: 20px;
background-color: #f44336;
color: white;
opacity: 1;
transition: opacity 0.6s;
margin-bottom: 15px;
}
.alert.success {background-color: #04AA6D;}
Above is the CSS code for the two messages' styles for your reference.
The message “Attendance ready to be taken” should be showing green..but it’s red color in the webpage.
So I guess it didn’t fulfill the conditional 'if' statement. That’s why it goes to 'else', and becomes red color.
But I'm not sure why it doesn’t. Because the message displayed is the same thing as the string i compared it with..
Does anyone know what's causing this weird bug?