def render(self, context): try: user = context['user'] count = cached_inbox_count_for(user) except (KeyError, AttributeError): count = '' if self.varname is not None: context[self.varname] = count return "" else: return "%s" % (count)
def render(self, context): try: user = context['user'] count = cached_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': cached_inbox_count_for(request.user)} else: return {}
def inbox(request): if request.user.is_authenticated(): return {'messages_inbox_count': cached_inbox_count_for(request.user)} else: return {}