From 6be40a5f2d75b157cf2a2374f2f866f6fdc92b18 Mon Sep 17 00:00:00 2001 From: Brandon Lo Date: Tue, 26 Nov 2019 16:39:26 -0500 Subject: Add warning email and notification This adds the abandoned changes made to the notification system and also adds a simple task to check for expiring bookings and sends out emails and notifications. Change-Id: I1530d19f41cf93626bb642e6b269f9ec55860b81 Signed-off-by: Brandon Lo --- src/notifier/models.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/notifier/models.py') diff --git a/src/notifier/models.py b/src/notifier/models.py index 49189e8..382d3a9 100644 --- a/src/notifier/models.py +++ b/src/notifier/models.py @@ -9,6 +9,7 @@ from django.db import models from account.models import UserProfile +from booking.models import Booking class Notification(models.Model): @@ -23,3 +24,29 @@ class Notification(models.Model): def to_preview_html(self): return "

" + self.title + "

" # TODO - template? + + +class Emailed(models.Model): + """ + A simple record to remember who has already gotten an email + to avoid resending + """ + begin_booking = models.OneToOneField( + Booking, + null=True, + on_delete=models.CASCADE, + related_name="begin_mail" + ) + almost_end_booking = models.OneToOneField( + Booking, + null=True, + on_delete=models.CASCADE, + related_name="warning_mail" + ) + end_booking = models.OneToOneField( + Booking, + null=True, + on_delete=models.CASCADE, + related_name="over_mail" + ) + -- cgit 1.2.3-korg