app/soc/models/student_proposal.py
author Lennard de Rijk <ljvderijk@gmail.com>
Fri, 20 Feb 2009 11:39:00 +0000
changeset 1412 fa274dd2f476
child 1421 7602d41f0ed8
permissions -rw-r--r--
First go at the student proposal model. The scope will be set to the student role and the link_id will be time-based. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1412
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     2
#
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     3
# Copyright 2009 the Melange authors.
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     4
#
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     8
# 
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    10
# 
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    16
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    17
"""This module contains the Student Proposal Model."""
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    18
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    19
__authors__ = [
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    20
  '"Lennard de Rijk" <ljvderijk@gmail.com>',
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    21
]
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    22
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    23
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    24
from google.appengine.ext import db
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    25
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    26
from django.utils.translation import ugettext
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    27
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    28
import soc.models.linkable
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    29
import soc.models.mentor
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    30
import soc.models.organization
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    31
import soc.models.program
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    32
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    33
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    34
class StudentProposal(soc.models.linkable.Linkable):
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    35
  """Model for a student proposal used in the GSoC workflow.
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    36
  """
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    37
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    38
  #: Required field indicating the "title" of the proposal
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    39
  title = db.StringProperty(required=True,
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    40
      verbose_name=ugettext('Title'))
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    41
  title.help_text = ugettext(
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    42
      'title of the proposal')
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    43
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    44
  #: optional, indexed plain text field used for different purposes,
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    45
  #: depending on the specific type of the work
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    46
  abstract = db.StringProperty(multiline=True)
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    47
  abstract.help_text = ugettext(
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    48
      'short abstract, summary, or snippet;'
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    49
      ' 500 characters or less, plain text displayed publicly')
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    50
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    51
  #: an URL linking to more information about this students proposal
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    52
  additional_info = db.URLProperty(required=False)
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    53
  additional_info.help_text = ugettext(
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    54
      'Link to a resource containing more information about your proposal')
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    55
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    56
  #: A property containing which mentor has assigned himself to this proposal
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    57
  #: Only a proposal with an assigned mentor can be turned into a accepted proposal
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    58
  #: A proposal can only have one mentor
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    59
  mentor = db.ReferenceProperty(reference_class=soc.models.mentor.Mentor,
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    60
                              required=False, collection_name='student_proposals')
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    61
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    62
  #: the current score of this proposal, used to determine which proposals
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    63
  #: should be assigned a project slot.
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    64
  score = db.IntegerProperty(required=True, default=0)
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    65
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    66
  #: the status of this proposal
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    67
  #: pending: the proposal is in the process of being ranked/scored
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    68
  #: accepted: the proposal has been assigned a project slot
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    69
  #: rejected: the proposal has not been assigned a slot or the organization
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    70
  #: does not want this proposal.
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    71
  #: invalid: the student or developer marked this as an invalid proposal.
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    72
  status = db.StringProperty(required=True, default='pending',
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    73
      choices=['pending','accepted', 'rejected', 'invalid'])
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    74
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    75
  #: organization to which this proposal is directed
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    76
  org = db.ReferenceProperty(reference_class=soc.models.organization.Organization,
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    77
                              required=True, collection_name='student_proposals')
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    78
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    79
  #: program in which this proposal has been created
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    80
  program = db.ReferenceProperty(reference_class=soc.models.program.Program,
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    81
                              required=True, collection_name='student_proposals')
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    82
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    83
  #: date when the proposal was created
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    84
  created_on = db.DateTimeProperty(required=True, auto_now_add=True)
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    85
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    86
  #: date when the proposal was last modified, should be set manually on edit
fa274dd2f476 First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    87
  modified_on = db.DateTimeProperty(required=True, auto_now_add=True)