Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/mitchellias/mchp-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mek32390 committed Aug 22, 2014
2 parents f6ece16 + a4e6f63 commit 65ea0df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 12 additions & 0 deletions mchp/lib/middleware.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytz

from django.utils import timezone
from django.contrib import messages

class TimezoneMiddleware(object):
# activate the current time zone for the student according to their school time zone
Expand All @@ -11,3 +12,14 @@ def process_request(self, request):
timezone.activate(pytz.timezone(tz))
else:
timezone.deactivate()

class CustomMessageMiddleware(object):

def process_request(self, request):
storage = messages.get_messages(request)
mes = []
# what = storage.inbox_list(request.user)
for message in storage:
mes.append(message)
setattr(request, 'rails_messages', mes)
# storage.used = False
4 changes: 1 addition & 3 deletions mchp/lib/templates/lib/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,7 @@ <h5><small>20 friends and 3 classes in common</small></h5>
<!-- end user popover -->
<!-- Django Messages -->
<div class="django-messages">
{% if messages %}
{% for message in messages %}
{% for message in request.rails_messages %}
{% if message.tags %}
<div class="alert alert-{{message.tags}} alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
Expand All @@ -285,7 +284,6 @@ <h5><small>20 friends and 3 classes in common</small></h5>
</div>
{% endif %}
{% endfor %}
{% endif %}
</div>
{% block body %}
{% endblock %}
Expand Down

0 comments on commit 65ea0df

Please sign in to comment.