app/soc/modules/ghop/models/work_submission.py
author Daniel Hans <Daniel.M.Hans@gmail.com>
Tue, 10 Nov 2009 13:59:15 +0100
changeset 3083 f384c0a42920
parent 2845 99121cc7181d
permissions -rw-r--r--
'scope' field moved from TaskTag to the parent class.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     2
#
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     3
# Copyright 2009 the Melange authors.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     4
#
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     8
#
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    10
#
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    16
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    17
"""This module contains the GHOP WorkSubmission Model.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    18
"""
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    19
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    20
__authors__ = [
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    21
  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    22
  '"Lennard de Rijk" <ljvderijk@gmail.com>',
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    23
]
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    24
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    25
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    26
from google.appengine.ext import db
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    27
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    28
from django.utils.translation import ugettext
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    29
2845
99121cc7181d GHOPWorkSubmission model is made id_based and inherits from base.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2821
diff changeset
    30
import soc.models.base
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    31
import soc.models.user
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    32
2845
99121cc7181d GHOPWorkSubmission model is made id_based and inherits from base.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2821
diff changeset
    33
from soc.modules.ghop.models import organization as ghop_org_model
2399
65a83ae32703 Changed imports in models to comply with recent GHOP code move.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2397
diff changeset
    34
from soc.modules.ghop.models import program as ghop_program_model
65a83ae32703 Changed imports in models to comply with recent GHOP code move.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2397
diff changeset
    35
from soc.modules.ghop.models import task as task_model
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    36
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    37
2845
99121cc7181d GHOPWorkSubmission model is made id_based and inherits from base.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2821
diff changeset
    38
class GHOPWorkSubmission(soc.models.base.ModelWithFieldAttributes):
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    39
  """Model for work submissions for a task by students.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    40
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    41
  Scope will be set to the Organization to which this work has been submitted.
2791
c62f45595b8d Removed reference to GHOPTask and GHOPProgram.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2399
diff changeset
    42
  scope_path will be set to the task key name under which this work was
c62f45595b8d Removed reference to GHOPTask and GHOPProgram.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2399
diff changeset
    43
  submitted.
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    44
  """
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    45
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    46
  #: User who submitted this work
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    47
  user = db.ReferenceProperty(reference_class=soc.models.user.User,
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    48
                              required=True,
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    49
                              collection_name='work_submissions')
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    50
2845
99121cc7181d GHOPWorkSubmission model is made id_based and inherits from base.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2821
diff changeset
    51
  #: Organization to which this work belongs to
99121cc7181d GHOPWorkSubmission model is made id_based and inherits from base.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2821
diff changeset
    52
  org = db.ReferenceProperty(
99121cc7181d GHOPWorkSubmission model is made id_based and inherits from base.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2821
diff changeset
    53
      reference_class=ghop_org_model.GHOPOrganization,
99121cc7181d GHOPWorkSubmission model is made id_based and inherits from base.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2821
diff changeset
    54
      required=True, collection_name='work_submissions')
99121cc7181d GHOPWorkSubmission model is made id_based and inherits from base.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2821
diff changeset
    55
2821
21dd1ee785f5 Added reference to GHOPProgram entity for Work Submissions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2791
diff changeset
    56
  #: Program to which this work belongs to
21dd1ee785f5 Added reference to GHOPProgram entity for Work Submissions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2791
diff changeset
    57
  program = db.ReferenceProperty(
21dd1ee785f5 Added reference to GHOPProgram entity for Work Submissions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2791
diff changeset
    58
      reference_class=ghop_program_model.GHOPProgram,
21dd1ee785f5 Added reference to GHOPProgram entity for Work Submissions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2791
diff changeset
    59
      required=True, collection_name='work_submissions')
21dd1ee785f5 Added reference to GHOPProgram entity for Work Submissions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2791
diff changeset
    60
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    61
  #: Property allowing you to store information about your work
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    62
  information = db.TextProperty(
2791
c62f45595b8d Removed reference to GHOPTask and GHOPProgram.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2399
diff changeset
    63
      required=False, verbose_name=ugettext('Info'))
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    64
  information.help_text = ugettext(
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    65
      'Information about the work you submit for this task')
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    66
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    67
  #: Property containing an URL to this work or more information about it
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    68
  url_to_work = db.LinkProperty(
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    69
      required=False, verbose_name=ugettext('URL to your Work'))
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    70
  url_to_work.help_text = ugettext(
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    71
      'URL to a resource containing your work or more information about it')
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    72
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    73
  #: Property containing the date when the work was submitted
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    74
  submitted_on = db.DateTimeProperty(required=True, auto_now_add=True,
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    75
                                     verbose_name=ugettext('Submitted on'))