app/ghop/models/work_submission.py
author Madhusudan C.S. <madhusudancs@gmail.com>
Mon, 25 May 2009 23:42:56 +0200
changeset 2347 c5a397f57d65
child 2348 0edff67b472d
permissions -rw-r--r--
Added several models related to the GHOP workflow. These models will form the base of the GHOP infrastructure together with the already commited task model. Reviewed by: Lennard de Rijk
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2347
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     2
#
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     3
# Copyright 2009 the Melange authors.
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     4
#
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     8
#
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    10
#
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    16
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    17
"""This module contains the GHOP WorkSubmission Model.
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    18
"""
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    19
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    20
__authors__ = [
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    21
  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    22
  '"Lennard de Rijk" <ljvderijk@gmail.com>',
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    23
]
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    24
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    25
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    26
from google.appengine.ext import db
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    27
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    28
from django.utils.translation import ugettext
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    29
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    30
import soc.models.linkable
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    31
import soc.models.user
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    32
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    33
import ghop.models.program
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    34
import ghop.models.task
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    35
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    36
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    37
class GHOPWorkSubmission(soc.models.linkable.Linkable):
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    38
  """Model for work submissions for a task by students.
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    39
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    40
  Scope will be set to the Organization to which this work has been submitted.
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    41
  """
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    42
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    43
  #: Task to which this work was submitted
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    44
  task = db.ReferenceProperty(reference_class=ghop.models.task.Task,
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    45
                              required=True,
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    46
                              collection_name='work_submissions')
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    47
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    48
  #: User who submitted this work
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    49
  user = db.ReferenceProperty(reference_class=soc.models.user.User,
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    50
                              required=True,
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    51
                              collection_name='work_submissions')
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    52
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    53
  #: Program to which this work belongs to
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    54
  program = db.ReferenceProperty(reference_class=ghop.models.program.GHOPProgram,
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    55
                                 required=True,
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    56
                                 collection_name='work_submissions')
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    57
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    58
  #: Property allowing you to store information about your work
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    59
  information = db.TextProperty(
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    60
      required=True, verbose_name=ugettext('Info'))
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    61
  information.help_text = ugettext(
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    62
      'Information about the work you submit for this task')
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    63
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    64
  #: Property containing an URL to this work or more information about it
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    65
  url_to_work = db.LinkProperty(
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    66
      required=False, verbose_name=ugettext('URL to your Work'))
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    67
  url_to_work.help_text = ugettext(
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    68
      'URL to a resource containing your work or more information about it')
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    69
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    70
  #: Property containing the date when the work was submitted
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    71
  submitted_on = db.DateTimeProperty(required=True, auto_now_add=True,
c5a397f57d65 Added several models related to the GHOP workflow.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    72
                                     verbose_name=ugettext('Submitted on'))