1 ##############################################################################
2 # Copyright (c) 2018 Sawyer Bergeron, Parker Berberian, 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 django.db import models
11 from booking.models import Booking
12 from account.models import UserProfile
13 from fernet_fields import EncryptedTextField
14 from account.models import Lab
17 class MetaBooking(models.Model):
18 id = models.AutoField(primary_key=True)
19 booking = models.OneToOneField(Booking, on_delete=models.CASCADE, related_name="metabooking")
20 ending_notified = models.BooleanField(default=False)
21 ended_notified = models.BooleanField(default=False)
22 created_notified = models.BooleanField(default=False)
25 class LabMessage(models.Model):
26 lab = models.ForeignKey(Lab, on_delete=models.CASCADE)
27 msg = models.TextField() # django template should be put here
30 class Notifier(models.Model):
31 id = models.AutoField(primary_key=True)
32 title = models.CharField(max_length=240)
33 content = EncryptedTextField()
34 user = models.ForeignKey(UserProfile, on_delete=models.CASCADE, null=True, blank=True)
35 sender = models.CharField(max_length=240, default='unknown')
36 message_type = models.CharField(max_length=240, default='email', choices=(
38 ('webnotification', 'Web Notification')))
45 Implement for next PR: send Notifier by media agreed to by user
51 return self.user.email_addr