From 9e8d930a3bab1c9ae7177002419dba11345788c3 Mon Sep 17 00:00:00 2001
From: "M.Ravi" <mondi.ravi@gmail.com>
Date: Sun, 1 Oct 2017 20:16:05 +0200
Subject: [PATCH] Refactor messages to includes/_messages.html

---
 hosting/templates/hosting/includes/_messages.html | 8 ++++++++
 hosting/templates/hosting/login.html              | 8 +-------
 2 files changed, 9 insertions(+), 7 deletions(-)
 create mode 100644 hosting/templates/hosting/includes/_messages.html

diff --git a/hosting/templates/hosting/includes/_messages.html b/hosting/templates/hosting/includes/_messages.html
new file mode 100644
index 00000000..13500fdb
--- /dev/null
+++ b/hosting/templates/hosting/includes/_messages.html
@@ -0,0 +1,8 @@
+{% if messages %}
+    <ul class="list-unstyled msg-list">
+    {% for message in messages %}
+        <div
+                class="alert {% if message.tags and message.tags == 'error' %} alert-danger {% else %} alert-{{message.tags}} {% endif %}">{{ message|safe }}</div>
+    {% endfor %}
+    </ul>
+{% endif %}
\ No newline at end of file
diff --git a/hosting/templates/hosting/login.html b/hosting/templates/hosting/login.html
index 82056d2f..eda3fffa 100644
--- a/hosting/templates/hosting/login.html
+++ b/hosting/templates/hosting/login.html
@@ -16,13 +16,7 @@
         <div class="auth-content">
             <div class="intro-message auth-box">
                 <h2 class="section-heading">{% trans "Login"%}</h2>
-                {% if messages %}
-                    <ul class="list-unstyled msg-list">
-                    {% for message in messages %}
-                        <li>{{ message }}</li>
-                    {% endfor %}
-                    </ul>
-                {% endif %}
+                {% include  'hosting/includes/_messages.html' %}
                 <form action="{% url 'hosting:login' %}" method="post" class="form" novalidated>
                     {% csrf_token %}
                     {% for field in form %}