[Django] Display message at redirect destination

environment Python 3.5.0 Django 1.9.2

settings.py


MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage'

views.py


from django.contrib import messages

messages.success(request, 'Has been updated!')

template.html


{% if messages %}
<ul class="messages">
    {% for message in messages %}
    <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
    {% endfor %}
</ul>
{% endif %}

References I want to do the same thing as the Rails Flash message in Django-Miscellaneous notes

Recommended Posts

[Django] Display message at redirect destination
[Django] Display the error message specified by raise ValidationError