app/soc/models/notification.py
changeset 726 ba3d399ec9be
child 737 4c78ee183eb6
equal deleted inserted replaced
725:6180b32d990f 726:ba3d399ec9be
       
     1 #!/usr/bin/python2.5
       
     2 #
       
     3 # Copyright 2008 the Melange authors.
       
     4 #
       
     5 # Licensed under the Apache License, Version 2.0 (the "License");
       
     6 # you may not use this file except in compliance with the License.
       
     7 # You may obtain a copy of the License at
       
     8 # 
       
     9 #   http://www.apache.org/licenses/LICENSE-2.0
       
    10 # 
       
    11 # Unless required by applicable law or agreed to in writing, software
       
    12 # distributed under the License is distributed on an "AS IS" BASIS,
       
    13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    14 # See the License for the specific language governing permissions and
       
    15 # limitations under the License.
       
    16 
       
    17 """This module contains the Notification Model.
       
    18 """
       
    19 
       
    20 __authors__ = [
       
    21   '"Lennard de Rijk" <ljvderijk@gmail.com>',
       
    22 ]
       
    23 
       
    24 from google.appengine.ext import db
       
    25 
       
    26 from django.utils.translation import ugettext_lazy
       
    27 
       
    28 from soc.models import base
       
    29 
       
    30 import soc.models.linkable
       
    31 import soc.models.user
       
    32 
       
    33 
       
    34 class Notification(soc.models.linkable.Linkable):
       
    35   """Model of a Notification.
       
    36   """
       
    37 
       
    38   # a reference to the user this Notification is from
       
    39   # this is a non-required property, None will indicate an Anonymous Admin
       
    40   from_user = db.ReferenceProperty(reference_class=soc.models.user.User,
       
    41       required=False,
       
    42       collection_name="sent_notifications",
       
    43       verbose_name=ugettext_lazy('From User'))
       
    44   
       
    45   subject = db.StringProperty(required=True,
       
    46       verbose_name=ugettext_lazy('Subject'))
       
    47   
       
    48   # the message that is contained within this Notification
       
    49   message = db.TextProperty(required=True,
       
    50       verbose_name=ugettext_lazy('Message'))
       
    51   
       
    52   # date and time on which this Notification was created
       
    53   created_on = db.DateTimeProperty(auto_now_add=True,
       
    54       verbose_name=ugettext_lazy('Created On'))
       
    55   
       
    56   # boolean property that marks if the notification has been read
       
    57   has_been_read = db.BooleanProperty(default=False,
       
    58       verbose_name=ugettext_lazy('Read'))