author | Sverre Rabbelier <srabbelier@gmail.com> |
Sun, 14 Dec 2008 00:33:59 +0000 | |
changeset 741 | 2dc2c65c5f76 |
parent 737 | 4c78ee183eb6 |
child 748 | f00e6b3af5a6 |
permissions | -rw-r--r-- |
726 | 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 |
||
737
4c78ee183eb6
Notification property has_been_read changed into unread
Lennard de Rijk <ljvderijk@gmail.com>
parents:
726
diff
changeset
|
56 |
# boolean property that marks if the notification is unread |
4c78ee183eb6
Notification property has_been_read changed into unread
Lennard de Rijk <ljvderijk@gmail.com>
parents:
726
diff
changeset
|
57 |
unread = db.BooleanProperty(default=True, |
4c78ee183eb6
Notification property has_been_read changed into unread
Lennard de Rijk <ljvderijk@gmail.com>
parents:
726
diff
changeset
|
58 |
verbose_name=ugettext_lazy('Unread')) |