# --------------------------------------------------------------------------- # unread_notifications_count() # --------------------------------------------------------------------------- def unread_notifications_count(request): """ Context processor: Returns the number of unread notifications for the current user. """ if not request.user.is_authenticated: return {"notifications_unread_count": 0} from .models import Notification count = Notification.objects.filter(user=request.user, read=False).count() return {"notifications_unread_count": count}