GHOPWorkSubmission model is made id_based and inherits from base.
authorMadhusudan.C.S <madhusudancs@gmail.com>
Sun, 30 Aug 2009 22:00:07 +0530
changeset 2845 99121cc7181d
parent 2844 ec22622da589
child 2846 6512c82180ba
GHOPWorkSubmission model is made id_based and inherits from base. Also a reference property to GHOPOrganization is added in GHOPWorkSubmission model.
app/soc/modules/ghop/logic/models/work_submission.py
app/soc/modules/ghop/models/work_submission.py
--- a/app/soc/modules/ghop/logic/models/work_submission.py	Sun Aug 30 17:34:47 2009 +0200
+++ b/app/soc/modules/ghop/logic/models/work_submission.py	Sun Aug 30 22:00:07 2009 +0530
@@ -21,28 +21,23 @@
     '"Madhusudan.C.S" <madhusudancs@gmail.com>'
   ]
 
-from soc.logic.models import linkable
+from soc.logic.models import base
 
-import soc.models.linkable
-
-import soc.modules.ghop.logic.models.organization
 import soc.modules.ghop.models.work_submission
 
 
-class Logic(linkable.Logic):
+class Logic(base.Logic):
   """Logic methods for the GHOPWorkSubmission model.
   """
 
   def __init__(
       self,
       model=soc.modules.ghop.models.work_submission.GHOPWorkSubmission,
-      base_model=soc.models.linkable.Linkable, 
-      scope_logic=soc.modules.ghop.logic.models.organization):
+      id_based=True):
     """Defines the name, key_name and model for this entity.
     """
 
-    super(Logic, self).__init__(model, base_model=base_model,
-                                scope_logic=scope_logic)
+    super(Logic, self).__init__(model, id_based=id_based)
 
 
 logic = Logic()
--- a/app/soc/modules/ghop/models/work_submission.py	Sun Aug 30 17:34:47 2009 +0200
+++ b/app/soc/modules/ghop/models/work_submission.py	Sun Aug 30 22:00:07 2009 +0530
@@ -27,14 +27,15 @@
 
 from django.utils.translation import ugettext
 
-import soc.models.linkable
+import soc.models.base
 import soc.models.user
 
+from soc.modules.ghop.models import organization as ghop_org_model
 from soc.modules.ghop.models import program as ghop_program_model
 from soc.modules.ghop.models import task as task_model
 
 
-class GHOPWorkSubmission(soc.models.linkable.Linkable):
+class GHOPWorkSubmission(soc.models.base.ModelWithFieldAttributes):
   """Model for work submissions for a task by students.
 
   Scope will be set to the Organization to which this work has been submitted.
@@ -47,6 +48,11 @@
                               required=True,
                               collection_name='work_submissions')
 
+  #: Organization to which this work belongs to
+  org = db.ReferenceProperty(
+      reference_class=ghop_org_model.GHOPOrganization,
+      required=True, collection_name='work_submissions')
+
   #: Program to which this work belongs to
   program = db.ReferenceProperty(
       reference_class=ghop_program_model.GHOPProgram,