[Answered ]-How can I model this behavior in Django?

1👍

You should have a look at the django-notifications package:
https://github.com/django-notifications/django-notifications

It does exactly what you want.
It also comes with a Live Updater Api to keep the unread notification number in sync.

1👍

I assume that you will have some view which will render page on which user of your site will be able to read the unread notifications. So I think you can simply add to notifications model bool field unread. This field is set up when there is new notification to true. After user render page with unread notifications this view simply change this filed to false. When you query using where(ureaded==true) for notifications one more time those will be avoided.

Leave a comment