diff --git a/core/context_processors.py b/core/context_processors.py index cc8602f..71e44d7 100644 --- a/core/context_processors.py +++ b/core/context_processors.py @@ -1,9 +1,11 @@ from .models import Notification def notifications(request): - if request.user.is_authenticated: - return { - 'notifications': Notification.objects.filter(user= request.user, read=False).order_by('-datetime') - } - else: - return request \ No newline at end of file + context = {} + context['notifications'] = None + if not request.user is None: + if request.user.is_authenticated: + return { + 'notifications': Notification.objects.filter(user= request.user, read=False).order_by('-datetime') + } + return context diff --git a/core/templates/index.html b/core/templates/index.html index 1e8918f..310f460 100644 --- a/core/templates/index.html +++ b/core/templates/index.html @@ -10,71 +10,86 @@ {% endblock sidebar %} {% block content %} -