|
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 Presence Model.""" |
|
18 |
|
19 __authors__ = [ |
|
20 '"Pawel Solyga" <pawel.solyga@gmail.com>', |
|
21 '"Todd Larsen" <tlarsen@google.com>', |
|
22 ] |
|
23 |
|
24 |
|
25 from google.appengine.ext import db |
|
26 |
|
27 from django.utils.translation import ugettext_lazy |
|
28 |
|
29 import soc.models.document |
|
30 import soc.models.linkable |
|
31 |
|
32 |
|
33 class Presence(soc.models.linkable.Linkable): |
|
34 """Model for anything that has a "presence" on a Melange site. |
|
35 |
|
36 A "presence" is (currently) defined as: |
|
37 * having a "home" page with contents set by selecting a Document |
|
38 * displaying an (optional) ATOM or RSS feed |
|
39 |
|
40 Models that have a "presence" on a Melange web site are (currently): |
|
41 * any Group (Organization, Club, etc.) |
|
42 * any Program |
|
43 * the site itself, which is a singleton Presence |
|
44 """ |
|
45 |
|
46 #: Reference to Document containing the contents of the "/home" page |
|
47 home = db.ReferenceProperty( |
|
48 reference_class=soc.models.document.Document, |
|
49 collection_name='home') |
|
50 home.help_text = ugettext_lazy( |
|
51 'Document to be used as the "/home" page static contents.') |
|
52 |
|
53 #: Valid ATOM or RSS feed url or None if unused. Feed entries are shown |
|
54 #: on the site page using Google's JavaScript blog widget |
|
55 feed_url = db.LinkProperty(verbose_name=ugettext_lazy('Feed URL')) |
|
56 feed_url.help_text = ugettext_lazy( |
|
57 'The URL should be a valid ATOM or RSS feed. ' |
|
58 'Feed entries are shown on the home page.') |