1 ##############################################################################
2 # Copyright (c) 2018 Sawyer Bergeron and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
10 from notifier.models import Notification
11 from django.shortcuts import render
14 def InboxView(request):
15 if request.user.is_authenticated:
18 return render(request, "dashboard/login.html", {'title': 'Authentication Required'})
20 return render(request, "notifier/inbox.html", {'notifications': Notification.objects.filter(recipient=user.userprofile)})
23 def NotificationView(request, notification_id):
24 if request.user.is_authenticated:
27 return render(request, "dashboard/login.html", {'title': 'Authentication Required'})
29 notification = Notification.objects.get(id=notification_id)
30 if user not in notification.recipients:
31 return render(request, "dashboard/login.html", {'title': 'Access Denied'})
33 return render(request, "notifier/notification.html", {'notification': notification})