summaryrefslogtreecommitdiffstats
path: root/dashboard/src/notifier/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'dashboard/src/notifier/models.py')
-rw-r--r--dashboard/src/notifier/models.py31
1 files changed, 9 insertions, 22 deletions
diff --git a/dashboard/src/notifier/models.py b/dashboard/src/notifier/models.py
index 9ebc6fc..49189e8 100644
--- a/dashboard/src/notifier/models.py
+++ b/dashboard/src/notifier/models.py
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 2016 Max Breitenfeldt and others.
+# Copyright (c) 2018 Sawyer Bergeron, Parker Berberian, and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -8,31 +8,18 @@
##############################################################################
from django.db import models
-from jira import JIRA, JIRAError
-from dashboard.models import Resource
-from booking.models import Booking
-from django.contrib.auth.models import User
from account.models import UserProfile
-from django.contrib import messages
-from django.db.models.signals import pre_save
-from fernet_fields import EncryptedTextField
-class Notifier(models.Model):
- id = models.AutoField(primary_key=True)
- title = models.CharField(max_length=240)
- content = EncryptedTextField()
- user = models.ForeignKey(UserProfile, on_delete=models.CASCADE, null=True, blank=True)
- sender = models.CharField(max_length=240, default='unknown')
- message_type = models.CharField(max_length=240, default='email', choices=(
- ('email','Email'),
- ('webnotification', 'Web Notification')))
- msg_sent = ''
- import notifier.dispatchers
+class Notification(models.Model):
+ title = models.CharField(max_length=150)
+ content = models.TextField()
+ recipients = models.ManyToManyField(UserProfile, related_name='notifications')
+ is_html = models.BooleanField(default=True)
+ read_by = models.ManyToManyField(UserProfile, related_name='read_notifications')
def __str__(self):
return self.title
- def getEmail(self):
- return self.user.email_addr
-
+ def to_preview_html(self):
+ return "<h3>" + self.title + "</h3>" # TODO - template?