Messages in django

Messages library is used for to print the message on web page according your needs.


add this setting in you


from django.contrib import messages


And this code for set the messages


messages.success(request, ‘Thanks for Register’)


Now add this code in any place where you want to show your mesaage

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


Now run your website page and check the all changes.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s