Skip to content

Instantly share code, notes, and snippets.

@codeinthehole
Created September 13, 2012 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeinthehole/3715353 to your computer and use it in GitHub Desktop.
Save codeinthehole/3715353 to your computer and use it in GitHub Desktop.
Model for a simple notification
class Notification(models.Model):
recipient = models.ForeignKey('auth.User', related_name='notifications')
# HTML is allowed in this field as it can contain links
text = models.CharField(max_length=255)
# Some projects may want to categorise their notifications. You may want
# to use this field to show a different icons next to the notification.
category = models.CharField(max_length=255, null=True)
INBOX, ARCHIVE = 'Inbox', 'Archive'
choices = (
(INBOX, _(INBOX)),
(ARCHIVE, _(ARCHIVE)))
location = models.CharField(max_length=32, choices=choices,
default=INBOX)
date_sent = models.DateTimeField(auto_now_add=True)
date_read = models.DateTimeField(null=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment