Regarding the messaging framework, I came across a documentation that mentions each message having a message.tag property which can be used for styling with CSS. My code implementation is as follows:
try:
models.save()
message.success(request, "Model successfully saved")
except DatabaseManagementTransaction:
message.error(request, "Model could not be saved")
within my HTML template
{% if messages %}
{% for message in messages %}
<div class="alert alert-{{message.tag}} alert-dissmissable">
{{message}}
</div>
{% endfor %}
{% endif %}
However, when the template is rendered, I am unable to see the message.tag and the div class appears like this:
<div class="alert alert- alert-dissmissable">...</div>
Do I need to set up MESSAGE_TAGS in the settings file for this functionality to work? Why is the message.tag empty? Additionally, what happens to the messages once they have been displayed to the user? Are they automatically deleted? If I were to add a new model, would the previous messages persist along with the new one?