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 account.models import UserProfile
14 class Notification(models.Model):
15 title = models.CharField(max_length=150)
16 content = models.TextField()
17 recipients = models.ManyToManyField(UserProfile, related_name='notifications')
18 is_html = models.BooleanField(default=True)
19 read_by = models.ManyToManyField(UserProfile, related_name='read_notifications')
24 def to_preview_html(self):
25 return "<h3>" + self.title + "</h3>" # TODO - template?