Created
September 13, 2012 16:04
-
-
Save codeinthehole/3715353 to your computer and use it in GitHub Desktop.
Model for a simple 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): | |
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