author | Lennard de Rijk <ljvderijk@gmail.com> |
Fri, 23 Jan 2009 08:49:09 +0000 | |
changeset 912 | 5b13221456f4 |
parent 824 | e964dca75527 |
child 970 | 8b5611d5b053 |
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 |
# |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
3 |
# Copyright 2008 the Melange authors. |
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 |
|
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
26 |
from django.utils.translation import ugettext_lazy |
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", |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
41 |
verbose_name=ugettext_lazy('From')) |
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, |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
44 |
verbose_name=ugettext_lazy('Subject')) |
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, |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
48 |
verbose_name=ugettext_lazy('Message')) |
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, |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
52 |
verbose_name=ugettext_lazy('Created On')) |
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, |
e964dca75527
Fixed whitespace and EOL damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
756
diff
changeset
|
56 |
verbose_name=ugettext_lazy('Unread')) |