def messages(request): """Add context variables related to ``messages`` app""" count = 0 ctx = {} if request.user.is_authenticated(): key = 'message-count-%s' % request.user.pk #count = cache.get(key) count = None if count is None: count = inbox_count_for(request.user) cache.set(key, count) ctx['UNREAD_MESSAGE_COUNT'] = count return ctx
def pm_unreads(user): return inbox_count_for(user)
def pm_unreads(user): if forum_settings.PM_SUPPORT: return inbox_count_for(user) return None
def inbox(request): if request.user.is_authenticated: return {'messages_inbox_count': inbox_count_for(request.user)} else: return {}
def inbox(request): if request.user.is_authenticated(): return {'messages_inbox_count': inbox_count_for(request.user)} else: return {}