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

123456789101112
  1. from django.db.models import get_model
  2. Notification = get_model('customer', 'Notification')
  3. def notifications(request):
  4. ctx = {}
  5. if request.user 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