Created
September 13, 2012 16:11
-
-
Save codeinthehole/3715430 to your computer and use it in GitHub Desktop.
Another model for a notification
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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