Skip to content

Instantly share code, notes, and snippets.

@codeinthehole
Created September 13, 2012 16:11
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/3715430 to your computer and use it in GitHub Desktop.
Save codeinthehole/3715430 to your computer and use it in GitHub Desktop.
Another model for a notification
class Notification(models.Model):
sender = models.ForeignKey('auth.User', null=True)
recipient = models.ForeignKey('auth.User', related_name='notifications')
subject = models.CharField(max_length=255)
body = models.TextField()
# 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