aboutsummaryrefslogtreecommitdiffstats
path: root/src/notifier/models.py
diff options
context:
space:
mode:
authorBrandon Lo <lobrandon1217@gmail.com>2019-11-26 16:39:26 -0500
committerBrandon Lo <lobrandon1217@gmail.com>2019-12-03 15:16:16 -0500
commit6be40a5f2d75b157cf2a2374f2f866f6fdc92b18 (patch)
treebdfa3b9ed77ebfef33f58262950ad551d579e3bb /src/notifier/models.py
parentf1d7b9300fbb06495c6087f975cdbb68a894da37 (diff)
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 <lobrandon1217@gmail.com>
Diffstat (limited to 'src/notifier/models.py')
-rw-r--r--src/notifier/models.py27
1 files changed, 27 insertions, 0 deletions
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 "<h3>" + self.title + "</h3>" # 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"
+ )
+