I am making a project in Django and want to render a styled message if a user fails to input their username/password correctly. The message does render, but it doesn't render using the CSS provided for it:
ul.messages li.error{
border: 1px solid;
margin: 10px auto;
padding: 15px 10px 15px 50px;
background-repeat: no-repeat;
background-position: 10px center;
max-width: 460px;
color: #D8000C;
background-color: #FFBABA;
}
I'm pretty sure doing ul.messages is overkill, but it's just something I tried. I've also tried .messages .error, .error, etc...
The relevant template code:
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
Again, the message renders, just not with the relevant CSS. The message call looks like this: messages.error(request, "Login failed due to incorrect username/password")
As it turns out, the actual issue was that the css file was cached by my web browser. See Django CSS not updating for options for solutions.