From 92381d8ab5cb4403929af3c29627e249f36c5a2c Mon Sep 17 00:00:00 2001 From: Andromeda Yelton Date: Thu, 29 Mar 2012 15:34:03 -0400 Subject: [PATCH] added an unseen_count variable available to all templates for notification signaling --- context_processors.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/context_processors.py b/context_processors.py index dfa33959..20afab88 100644 --- a/context_processors.py +++ b/context_processors.py @@ -1,3 +1,11 @@ def is_preview(request): from django.conf import settings - return {'is_preview': settings.IS_PREVIEW, 'jquery_home': settings.JQUERY_HOME, 'jquery_ui_home': settings.JQUERY_UI_HOME} \ No newline at end of file + return {'is_preview': settings.IS_PREVIEW, 'jquery_home': settings.JQUERY_HOME, 'jquery_ui_home': settings.JQUERY_UI_HOME} + +def count_unseen(request): + from notification import NoticeManager + if request.user.is_anonymous(): + count = 0 + else: + count = NoticeManager.unseen_count_for(request.user) + return {'unseen_count': count } \ No newline at end of file