app/soc/models/student_project.py
author Lennard de Rijk <ljvderijk@gmail.com>
Fri, 05 Jun 2009 22:07:15 +0200
changeset 2398 3ea483cf4d59
parent 2183 4e036dcc79ba
child 2573 f09f317769c4
permissions -rw-r--r--
Removed unused import.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1932
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     2
#
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     3
# Copyright 2009 the Melange authors.
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     4
#
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     8
# 
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    10
# 
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    16
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    17
"""This module contains the Student Project Model.
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    18
"""
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    19
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    20
__authors__ = [
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    21
  '"Lennard de Rijk" <ljvderijk@gmail.com>',
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    22
]
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    23
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    24
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    25
from google.appengine.ext import db
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    26
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    27
from django.utils.translation import ugettext
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    28
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    29
import soc.models.linkable
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    30
import soc.models.mentor
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    31
import soc.models.program
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    32
import soc.models.student
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    33
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    34
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    35
class StudentProject(soc.models.linkable.Linkable):
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    36
  """Model for a student project used in the GSoC workflow.
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    37
  """
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    38
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    39
  #: Required field indicating the "title" of the project
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    40
  title = db.StringProperty(required=True,
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    41
      verbose_name=ugettext('Title'))
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    42
  title.help_text = ugettext('Title of the project')
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    43
2124
ac484d0e4304 Added public_info property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2122
diff changeset
    44
  #: Required, text field describing the project
1932
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    45
  abstract = db.TextProperty(required=True)
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    46
  abstract.help_text = ugettext(
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    47
      'Short abstract, summary, or snippet;'
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    48
      ' 500 characters or less, plain text displayed publicly')
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    49
2124
ac484d0e4304 Added public_info property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2122
diff changeset
    50
  #: Optional, text field containing all kinds of information about this project
ac484d0e4304 Added public_info property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2122
diff changeset
    51
  public_info = db.TextProperty(required=False, default ='')
ac484d0e4304 Added public_info property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2122
diff changeset
    52
  public_info.help_text = ugettext(
ac484d0e4304 Added public_info property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2122
diff changeset
    53
      'Additional information about this project to be shown publicly')
ac484d0e4304 Added public_info property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2122
diff changeset
    54
ac484d0e4304 Added public_info property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2122
diff changeset
    55
  #: Optional, URL which can give more information about this project
1932
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    56
  additional_info = db.URLProperty(required=False)
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    57
  additional_info.help_text = ugettext(
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    58
      'Link to a resource containing more information about this project.')
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    59
2122
b709f9d1566a Added feed_url to StudentProject.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1932
diff changeset
    60
  #: Optional field storing a feed URL; displayed publicly.
b709f9d1566a Added feed_url to StudentProject.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1932
diff changeset
    61
  feed_url = db.LinkProperty(
b709f9d1566a Added feed_url to StudentProject.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1932
diff changeset
    62
      verbose_name=ugettext('Project Feed URL'))
b709f9d1566a Added feed_url to StudentProject.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1932
diff changeset
    63
  feed_url.help_text = ugettext(
b709f9d1566a Added feed_url to StudentProject.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1932
diff changeset
    64
      'The URL should be a valid ATOM or RSS feed. '
2124
ac484d0e4304 Added public_info property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2122
diff changeset
    65
      'Feed entries are shown on the public page.')
2122
b709f9d1566a Added feed_url to StudentProject.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1932
diff changeset
    66
1932
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    67
  #: A property containing which mentor has been assigned to this project.
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    68
  #: A project must have a mentor at all times
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    69
  mentor = db.ReferenceProperty(reference_class=soc.models.mentor.Mentor,
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    70
                                required=True,
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    71
                                collection_name='student_projects')
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    72
2183
4e036dcc79ba Added additional_mentors property to StudentProject.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2124
diff changeset
    73
  #: A property containing a list of additional Mentors for this project
4e036dcc79ba Added additional_mentors property to StudentProject.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2124
diff changeset
    74
  additional_mentors = db.ListProperty(item_type=db.Key, default=[])
4e036dcc79ba Added additional_mentors property to StudentProject.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2124
diff changeset
    75
2124
ac484d0e4304 Added public_info property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2122
diff changeset
    76
  #: The status of this project
1932
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    77
  #: accepted: This project has been accepted into the program
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    78
  #: mid_term_passed: This project has passed the midterm evaluation
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    79
  #: mid_term_failed: This project has failed the midterm evaluation
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    80
  #: final_failed: This project has failed the final evaluation
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    81
  #: passed: This project has completed the program successfully
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    82
  status = db.StringProperty(required=True, default='accepted',
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    83
      choices=['accepted', 'mid_term_passed', 'mid_term_failed', 
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    84
              'final_failed', 'passed'])
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    85
2124
ac484d0e4304 Added public_info property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2122
diff changeset
    86
  #: Student which this project is from
1932
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    87
  student = db.ReferenceProperty(
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    88
      reference_class=soc.models.student.Student,
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    89
      required=True, collection_name='student_projects')
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    90
2124
ac484d0e4304 Added public_info property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2122
diff changeset
    91
  #: Program in which this project has been created
1932
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    92
  program = db.ReferenceProperty(reference_class=soc.models.program.Program,
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    93
                                 required=True, 
08fb1074b665 Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    94
                                 collection_name='student_projects')