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