from at_django_boilerplate.notification.models import Notification


def get_unread_messages(request):
    data = {'unread_count':0}
    if request.user.is_authenticated:
        x = Notification.objects.filter(recipient=request.user,
                                        is_read=False)
        data['unread_count'] = x.count()
    return data