You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

context_processors.py 282B

123456789
  1. from django.db.models import get_model
  2. Notification = get_model('notifications', 'Notification')
  3. def notifications(request):
  4. num_unread = Notification.objects.filter(
  5. recipient=request.user, date_read=None).count()
  6. return {'num_unread_notifications': num_unread}