app/soc/models/site.py
author Augie Fackler <durin42@gmail.com>
Sun, 12 Jul 2009 11:46:36 -0500
changeset 2613 169d69967431
parent 1592 4465cda55182
permissions -rw-r--r--
buildout.cfg: We require nose as well for tests.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
141
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
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.
141
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     4
#
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     8
# 
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    10
# 
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    16
534
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 465
diff changeset
    17
"""This module contains the Site Model."""
141
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    18
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    19
__authors__ = [
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    20
  '"Pawel Solyga" <pawel.solyga@gmail.com>',
453
229e39d268a6 Add a Google Maps property to Site Settings
Sverre Rabbelier <srabbelier@gmail.com>
parents: 411
diff changeset
    21
  '"Lennard de Rijk" <ljvderijk@gmail.com>',
141
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    22
]
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    23
206
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    24
405
f3525c1288ed Add Google Analytics support to Site Settings. The reason I created additional SettingsValidationForm is because you cannot inherit from Form that has already defined Meta class, so it's sort of workaround for that. I didn't want to have same validation functions in both Form classes.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    25
from google.appengine.ext import db
f3525c1288ed Add Google Analytics support to Site Settings. The reason I created additional SettingsValidationForm is because you cannot inherit from Form that has already defined Meta class, so it's sort of workaround for that. I didn't want to have same validation functions in both Form classes.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    26
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 534
diff changeset
    27
from django.utils.translation import ugettext
405
f3525c1288ed Add Google Analytics support to Site Settings. The reason I created additional SettingsValidationForm is because you cannot inherit from Form that has already defined Meta class, so it's sort of workaround for that. I didn't want to have same validation functions in both Form classes.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    28
1053
3b9552cf748a Rename the confusing Tossed Model class to PresenceWithToS.
Todd Larsen <tlarsen@google.com>
parents: 1051
diff changeset
    29
import soc.models.presence_with_tos
181
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 141
diff changeset
    30
206
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    31
1053
3b9552cf748a Rename the confusing Tossed Model class to PresenceWithToS.
Todd Larsen <tlarsen@google.com>
parents: 1051
diff changeset
    32
class Site(soc.models.presence_with_tos.PresenceWithToS):
534
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 465
diff changeset
    33
  """Model of a Site, which stores per site configuration.
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 465
diff changeset
    34
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 465
diff changeset
    35
  The Site Model stores configuration information unique to the Melange
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 465
diff changeset
    36
  web site as a whole (in addition to any configuration that is common to
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 465
diff changeset
    37
  any "presence" on the site, such as a Group or Program).
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 465
diff changeset
    38
  """
141
e120c24b89e2 Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    39
1447
5e729070dc60 Added a 'site name' property to site
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1389
diff changeset
    40
  #: The official name of the site
5e729070dc60 Added a 'site name' property to site
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1389
diff changeset
    41
  site_name = db.StringProperty(default="Melange",
5e729070dc60 Added a 'site name' property to site
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1389
diff changeset
    42
      verbose_name=ugettext('Site Name'))
5e729070dc60 Added a 'site name' property to site
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1389
diff changeset
    43
  site_name.help_text = ugettext('The official name of the Site')
5e729070dc60 Added a 'site name' property to site
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1389
diff changeset
    44
1579
a06d60fcb23d Added a site-wide notice
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1447
diff changeset
    45
  #: A notice that should be displayed site-wide
a06d60fcb23d Added a site-wide notice
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1447
diff changeset
    46
  site_notice = db.StringProperty(verbose_name=ugettext('Site Notice'))
a06d60fcb23d Added a site-wide notice
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1447
diff changeset
    47
  site_notice.help_text = ugettext('A notice that will be displayed site-wide')
a06d60fcb23d Added a site-wide notice
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1447
diff changeset
    48
1585
06fb5950cb03 Make it possible to put the site in maintenance mode
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1579
diff changeset
    49
  maintenance_start = db.DateTimeProperty(
06fb5950cb03 Make it possible to put the site in maintenance mode
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1579
diff changeset
    50
      verbose_name=ugettext('Maintenance start date'))
06fb5950cb03 Make it possible to put the site in maintenance mode
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1579
diff changeset
    51
1592
4465cda55182 Add a maintenance end date
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1585
diff changeset
    52
  maintenance_end = db.DateTimeProperty(
4465cda55182 Add a maintenance end date
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1585
diff changeset
    53
      verbose_name=ugettext('Maintenance end date'))
4465cda55182 Add a maintenance end date
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1585
diff changeset
    54
405
f3525c1288ed Add Google Analytics support to Site Settings. The reason I created additional SettingsValidationForm is because you cannot inherit from Form that has already defined Meta class, so it's sort of workaround for that. I didn't want to have same validation functions in both Form classes.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    55
  #: Valid Google Analytics tracking number, if entered every page
f3525c1288ed Add Google Analytics support to Site Settings. The reason I created additional SettingsValidationForm is because you cannot inherit from Form that has already defined Meta class, so it's sort of workaround for that. I didn't want to have same validation functions in both Form classes.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    56
  #: is going to have Google Analytics JS initialization code in 
f3525c1288ed Add Google Analytics support to Site Settings. The reason I created additional SettingsValidationForm is because you cannot inherit from Form that has already defined Meta class, so it's sort of workaround for that. I didn't want to have same validation functions in both Form classes.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    57
  #: the footer with the given tracking number.
534
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 465
diff changeset
    58
  ga_tracking_num = db.StringProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 534
diff changeset
    59
      verbose_name=ugettext('Google Analytics'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 534
diff changeset
    60
  ga_tracking_num.help_text = ugettext(
405
f3525c1288ed Add Google Analytics support to Site Settings. The reason I created additional SettingsValidationForm is because you cannot inherit from Form that has already defined Meta class, so it's sort of workaround for that. I didn't want to have same validation functions in both Form classes.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    61
      'Valid Google Analytics tracking number. If the number is '
f3525c1288ed Add Google Analytics support to Site Settings. The reason I created additional SettingsValidationForm is because you cannot inherit from Form that has already defined Meta class, so it's sort of workaround for that. I didn't want to have same validation functions in both Form classes.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    62
      'entered every page is going to have Google Analytics '
f3525c1288ed Add Google Analytics support to Site Settings. The reason I created additional SettingsValidationForm is because you cannot inherit from Form that has already defined Meta class, so it's sort of workaround for that. I didn't want to have same validation functions in both Form classes.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    63
      'initialization code in footer.')
f3525c1288ed Add Google Analytics support to Site Settings. The reason I created additional SettingsValidationForm is because you cannot inherit from Form that has already defined Meta class, so it's sort of workaround for that. I didn't want to have same validation functions in both Form classes.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    64
464
c8cfb488adf4 Change partial path and link name verbose names in home_settings.py. Some comments fixes in site_settings.py.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 453
diff changeset
    65
  #: Valid Google Maps API Key. Used to embed Google Maps.
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 534
diff changeset
    66
  gmaps_api_key = db.StringProperty(verbose_name=ugettext('Google Maps'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 534
diff changeset
    67
  gmaps_api_key.help_text = ugettext(
453
229e39d268a6 Add a Google Maps property to Site Settings
Sverre Rabbelier <srabbelier@gmail.com>
parents: 411
diff changeset
    68
      'Valid Google Maps API Key. This key is used for '
229e39d268a6 Add a Google Maps property to Site Settings
Sverre Rabbelier <srabbelier@gmail.com>
parents: 411
diff changeset
    69
      'embedding Google Maps into the website.')
1389
da41001a097e Add noreply email property to Site model. Still missing cleaner method and changes in notifications module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1308
diff changeset
    70
da41001a097e Add noreply email property to Site model. Still missing cleaner method and changes in notifications module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1308
diff changeset
    71
  #: No Reply Email address used for sending notification emails to site users 
da41001a097e Add noreply email property to Site model. Still missing cleaner method and changes in notifications module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1308
diff changeset
    72
  noreply_email = db.EmailProperty(verbose_name=ugettext('No reply email'))
da41001a097e Add noreply email property to Site model. Still missing cleaner method and changes in notifications module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1308
diff changeset
    73
  noreply_email.help_text = ugettext(
da41001a097e Add noreply email property to Site model. Still missing cleaner method and changes in notifications module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1308
diff changeset
    74
      'No reply email address is used for sending emails to site users. '
da41001a097e Add noreply email property to Site model. Still missing cleaner method and changes in notifications module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1308
diff changeset
    75
      'Email address provided in this field needs to be added as Developer '
da41001a097e Add noreply email property to Site model. Still missing cleaner method and changes in notifications module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1308
diff changeset
    76
      'in GAE admin console.')