From 81cfb043f06ab71da7c021a063f80f6df58305cc Mon Sep 17 00:00:00 2001 From: Parker Berberian Date: Wed, 24 Oct 2018 15:12:32 -0400 Subject: Rewrite Notification subsystem In this commit: - delete a lot of really bad and / or unused code - redesign a much simpler Notification model - create and send notifications to the user's inbox on booking start & end - migrations - emails user when booking is ready and when it ends Not in this commit: - Creating notifications from lab messages - warning messages when a booking is about to end - creating "summary" notifications when e.g. a booking has been fulfilled by a lab Change-Id: I69b4dc36c3f2bce76d810106baadeef5a562cc7d Signed-off-by: Parker Berberian --- dashboard/src/api/views.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'dashboard/src/api/views.py') diff --git a/dashboard/src/api/views.py b/dashboard/src/api/views.py index 072354f..cc3a668 100644 --- a/dashboard/src/api/views.py +++ b/dashboard/src/api/views.py @@ -21,11 +21,11 @@ from django.views.decorators.csrf import csrf_exempt import json from api.serializers.booking_serializer import * -from api.serializers.old_serializers import NotifierSerializer, UserSerializer +from api.serializers.old_serializers import UserSerializer from account.models import UserProfile from booking.models import Booking -from notifier.models import Notifier from api.models import * +from notifier.manager import NotificationHandler class BookingViewSet(viewsets.ModelViewSet): @@ -34,11 +34,6 @@ class BookingViewSet(viewsets.ModelViewSet): filter_fields = ('resource', 'id') -class NotifierViewSet(viewsets.ModelViewSet): - queryset = Notifier.objects.none() - serializer_class = NotifierSerializer - - class UserViewSet(viewsets.ModelViewSet): queryset = UserProfile.objects.all() serializer_class = UserSerializer @@ -87,6 +82,7 @@ def specific_task(request, lab_name="", job_id="", task_id=""): if 'message' in request.POST: task.message = request.POST.get('message') task.save() + NotificationHandler.task_updated(task) d = {} d['task'] = task.config.get_delta() m = {} -- cgit 1.2.3-korg