def render(self, context):
     try:
         user = context['user']
         count = inbox_count_for(user)
     except (KeyError, AttributeError):
         count = ''
     if self.varname is not None:
         context[self.varname] = count
         return ""
     else:
         return "%s" % (count)
예제 #2
0
 def render(self, context):
     try:
         user = context['user']
         count = inbox_count_for(user)
     except (KeyError, AttributeError):
         count = ''
     if self.varname is not None:
         context[self.varname] = count
         return ""
     else:
         return "%s" % (count)
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 {}