1. Kevin Veroneau
  2. django-bootstrap-theme

Commits

Kevin Veroneau  committed 64930f7

Added context_processor to easily enable a system-wide message notification to use for server maintance notices and such.

  • Participants
  • Parent commits f916708
  • Branches default

Comments (0)

Files changed (2)

File bootstrap_theme/context_processors.py

View file
  • Ignore whitespace
+from django.conf import settings
+
+def system_message(req):
+    """
+    This function is to display a system-wide message to connected users.
+    An example would be stating when the server is going to have a maintaince period.
+    """
+    if hasattr(settings, 'SYSTEM_MESSAGE'):
+        return {'SYSTEM_MESSAGE': settings.SYSTEM_MESSAGE}
+    return {}

File bootstrap_theme/templates/bootstrap_theme/fragments/messages.html

View file
  • Ignore whitespace
           <div id="messages">
+            {% if SYSTEM_MESSAGE %}
+            <div class="alert alert-warning"><strong>System Message:</strong> {{SYSTEM_MESSAGE}}</div>
+            {% endif %}
             {% if messages %}
             {% for message in messages %}
             <div class="alert alert-{{message.tags}}">