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 391B

123456789101112
  1. from oscar.core.loading import get_model
  2. Notification = get_model('customer', 'Notification')
  3. def notifications(request):
  4. ctx = {}
  5. if getattr(request, 'user', None) and request.user.is_authenticated():
  6. num_unread = Notification.objects.filter(
  7. recipient=request.user, date_read=None).count()
  8. ctx['num_unread_notifications'] = num_unread
  9. return ctx