Highlight unread notifications

This commit is contained in:
Mouse Reeve
2020-03-10 13:31:57 -07:00
parent 3ddd4a0490
commit e8cfa99cd9
3 changed files with 8 additions and 1 deletions

View File

@ -139,12 +139,15 @@ def register(request):
return redirect('/')
@login_required
def notifications_page(request):
''' list notitications '''
notifications = request.user.notification_set.all() \
.order_by('-created_date')
unread = [n.id for n in notifications.filter(read=False)]
data = {
'notifications': notifications,
'unread': unread,
}
notifications.update(read=True)
return TemplateResponse(request, 'notifications.html', data)