Added base Model for Expando models.
authorLennard de Rijk <ljvderijk@gmail.com>
Wed, 12 Aug 2009 13:32:29 -0700
changeset 2763 80d625f78176
parent 2762 02b464717ef5
child 2764 6ed5a3e26692
Added base Model for Expando models. Due to comments on r031e5828f3.
app/soc/models/expando_base.py
app/soc/models/survey.py
app/soc/models/survey_record.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/models/expando_base.py	Wed Aug 12 13:32:29 2009 -0700
@@ -0,0 +1,34 @@
+#!/usr/bin/python2.5
+#
+# Copyright 2009 the Melange authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Module that cointains base class for Melange Expando models.
+"""
+
+__authors__ = [
+  '"Lennard de Rijk" <ljvderijk@gmail.com>',
+]
+
+
+from google.appengine.ext import db
+
+
+class ExpandoBase(db.Expando):
+  """Expando Base model.
+
+  This might later on contain general functionalities like the
+  ModelWithFieldAttributes model.
+  """
+  pass
\ No newline at end of file
--- a/app/soc/models/survey.py	Wed Aug 12 11:31:05 2009 -0700
+++ b/app/soc/models/survey.py	Wed Aug 12 13:32:29 2009 -0700
@@ -31,13 +31,15 @@
 
 from django.utils.translation import ugettext
 
+from soc.models.expando_base import ExpandoBase
+
 import soc.models.work
 
 
 COMMENT_PREFIX = 'comment_for_'
 
 
-class SurveyContent(db.Expando):
+class SurveyContent(ExpandoBase):
   """Fields (questions) and schema representation of a Survey.
 
   Each survey content entity consists of properties where names and default
--- a/app/soc/models/survey_record.py	Wed Aug 12 11:31:05 2009 -0700
+++ b/app/soc/models/survey_record.py	Wed Aug 12 13:32:29 2009 -0700
@@ -28,11 +28,12 @@
 
 from django.utils.translation import ugettext
 
+from soc.models.expando_base import ExpandoBase
 from soc.models.survey import Survey
 import soc.models.user
 
 
-class BaseSurveyRecord(db.Expando):
+class BaseSurveyRecord(ExpandoBase):
   """Record produced each time Survey is taken.
 
   Like SurveyContent, this model includes dynamic properties