author | Madhusudan.C.S <madhusudancs@gmail.com> |
Tue, 15 Sep 2009 22:01:16 +0200 | |
changeset 2926 | effa1cfb3607 |
parent 1308 | 35b75ffcbb37 |
permissions | -rw-r--r-- |
824
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
2 |
# |
1308
35b75ffcbb37
Partially reverted "Update the copyright notice for 2009."
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1307
diff
changeset
|
3 |
# Copyright 2008 the Melange authors. |
824
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
4 |
# |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
7 |
# You may obtain a copy of the License at |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
8 |
# |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
10 |
# |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
15 |
# limitations under the License. |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
16 |
|
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
17 |
"""This module contains the Notification Model. |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
18 |
""" |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
19 |
|
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
20 |
__authors__ = [ |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
21 |
'"Lennard de Rijk" <ljvderijk@gmail.com>', |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
22 |
] |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
23 |
|
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
24 |
from google.appengine.ext import db |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
25 |
|
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
824
diff
changeset
|
26 |
from django.utils.translation import ugettext |
824
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
27 |
|
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
28 |
import soc.models.linkable |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
29 |
import soc.models.user |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
30 |
|
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
31 |
|
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
32 |
class Notification(soc.models.linkable.Linkable): |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
33 |
"""Model of a Notification. |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
34 |
""" |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
35 |
|
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
36 |
#: a reference to the user this Notification is from |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
37 |
#: this is a non-required property, None will indicate an Anonymous Admin |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
38 |
from_user = db.ReferenceProperty(reference_class=soc.models.user.User, |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
39 |
required=False, |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
40 |
collection_name="sent_notifications", |
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
824
diff
changeset
|
41 |
verbose_name=ugettext('From')) |
824
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
42 |
|
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
43 |
subject = db.StringProperty(required=True, |
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
824
diff
changeset
|
44 |
verbose_name=ugettext('Subject')) |
824
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
45 |
|
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
46 |
#: the message that is contained within this Notification |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
47 |
message = db.TextProperty(required=True, |
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
824
diff
changeset
|
48 |
verbose_name=ugettext('Message')) |
824
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
49 |
|
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
50 |
#: date and time on which this Notification was created |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
51 |
created_on = db.DateTimeProperty(auto_now_add=True, |
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
824
diff
changeset
|
52 |
verbose_name=ugettext('Created On')) |
824
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
53 |
|
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
54 |
#: boolean property that marks if the notification is unread |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
55 |
unread = db.BooleanProperty(default=True, |
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
824
diff
changeset
|
56 |
verbose_name=ugettext('Unread')) |