def get_num(user): if not user.is_authenticated(): return 0 return len(BaseNotification.by_receiver(user, read=False, deleted=False))
def get_notifications(user): if not user.is_authenticated(): return [] return BaseNotification.by_receiver(user, deleted=False).order_by('-date')