app/soc/models/notification.py
changeset 748 f00e6b3af5a6
parent 737 4c78ee183eb6
child 756 a0c0b48563cb
equal deleted inserted replaced
747:ad62f4c3245e 748:f00e6b3af5a6
    23 
    23 
    24 from google.appengine.ext import db
    24 from google.appengine.ext import db
    25 
    25 
    26 from django.utils.translation import ugettext_lazy
    26 from django.utils.translation import ugettext_lazy
    27 
    27 
    28 from soc.models import base
       
    29 
       
    30 import soc.models.linkable
    28 import soc.models.linkable
    31 import soc.models.user
    29 import soc.models.user
    32 
    30 
    33 
    31 
    34 class Notification(soc.models.linkable.Linkable):
    32 class Notification(soc.models.linkable.Linkable):
    35   """Model of a Notification.
    33   """Model of a Notification.
    36   """
    34   """
    37 
    35 
    38   # a reference to the user this Notification is from
    36   #: a reference to the user this Notification is from
    39   # this is a non-required property, None will indicate an Anonymous Admin
    37   #: this is a non-required property, None will indicate an Anonymous Admin
    40   from_user = db.ReferenceProperty(reference_class=soc.models.user.User,
    38   from_user = db.ReferenceProperty(reference_class=soc.models.user.User,
    41       required=False,
    39       required=False,
    42       collection_name="sent_notifications",
    40       collection_name="sent_notifications",
    43       verbose_name=ugettext_lazy('From User'))
    41       verbose_name=ugettext_lazy('From User'))
    44   
    42   
    45   subject = db.StringProperty(required=True,
    43   subject = db.StringProperty(required=True,
    46       verbose_name=ugettext_lazy('Subject'))
    44       verbose_name=ugettext_lazy('Subject'))
    47   
    45   
    48   # the message that is contained within this Notification
    46   #: the message that is contained within this Notification
    49   message = db.TextProperty(required=True,
    47   message = db.TextProperty(required=True,
    50       verbose_name=ugettext_lazy('Message'))
    48       verbose_name=ugettext_lazy('Message'))
    51   
    49   
    52   # date and time on which this Notification was created
    50   #: date and time on which this Notification was created
    53   created_on = db.DateTimeProperty(auto_now_add=True,
    51   created_on = db.DateTimeProperty(auto_now_add=True,
    54       verbose_name=ugettext_lazy('Created On'))
    52       verbose_name=ugettext_lazy('Created On'))
    55   
    53   
    56   # boolean property that marks if the notification is unread
    54   #: boolean property that marks if the notification is unread
    57   unread = db.BooleanProperty(default=True,
    55   unread = db.BooleanProperty(default=True,
    58       verbose_name=ugettext_lazy('Unread'))
    56       verbose_name=ugettext_lazy('Unread'))