author | Lennard de Rijk <ljvderijk@gmail.com> |
Sat, 21 Feb 2009 11:14:44 +0000 | |
changeset 1428 | 36a0ebe0c868 |
parent 1421 | 7602d41f0ed8 |
child 1568 | cdbe6e86506c |
permissions | -rw-r--r-- |
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 |
|
1421
7602d41f0ed8
Made some changes to StudentProposal.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1412
diff
changeset
|
17 |
"""This module contains the Student Proposal Model. |
7602d41f0ed8
Made some changes to StudentProposal.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1412
diff
changeset
|
18 |
""" |
1412
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
19 |
|
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
20 |
__authors__ = [ |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
21 |
'"Lennard de Rijk" <ljvderijk@gmail.com>', |
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 |
|
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
25 |
from google.appengine.ext import db |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
26 |
|
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
27 |
from django.utils.translation import ugettext |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
28 |
|
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
29 |
import soc.models.linkable |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
30 |
import soc.models.mentor |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
31 |
import soc.models.organization |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
32 |
import soc.models.program |
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 |
|
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
35 |
class StudentProposal(soc.models.linkable.Linkable): |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
36 |
"""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
|
37 |
""" |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
38 |
|
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
39 |
#: 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
|
40 |
title = db.StringProperty(required=True, |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
41 |
verbose_name=ugettext('Title')) |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
42 |
title.help_text = ugettext( |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
43 |
'title of the proposal') |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
44 |
|
1421
7602d41f0ed8
Made some changes to StudentProposal.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1412
diff
changeset
|
45 |
#: required, text field used for different purposes, |
7602d41f0ed8
Made some changes to StudentProposal.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1412
diff
changeset
|
46 |
#: depending on the specific type of the proposal |
7602d41f0ed8
Made some changes to StudentProposal.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1412
diff
changeset
|
47 |
abstract = db.StringProperty(required=True, multiline=True) |
1412
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
48 |
abstract.help_text = ugettext( |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
49 |
'short abstract, summary, or snippet;' |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
50 |
' 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
|
51 |
|
1421
7602d41f0ed8
Made some changes to StudentProposal.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1412
diff
changeset
|
52 |
#: Required field containing the content of the proposal. |
7602d41f0ed8
Made some changes to StudentProposal.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1412
diff
changeset
|
53 |
content = db.StringProperty(required=True, multiline=True) |
7602d41f0ed8
Made some changes to StudentProposal.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1412
diff
changeset
|
54 |
content.help_text = ugettext( |
7602d41f0ed8
Made some changes to StudentProposal.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1412
diff
changeset
|
55 |
'This contains your actual proposal') |
7602d41f0ed8
Made some changes to StudentProposal.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1412
diff
changeset
|
56 |
|
1412
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
57 |
#: 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
|
58 |
additional_info = db.URLProperty(required=False) |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
59 |
additional_info.help_text = ugettext( |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
60 |
'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
|
61 |
|
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
62 |
#: 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
|
63 |
#: 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
|
64 |
#: A proposal can only have one mentor |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
65 |
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
|
66 |
required=False, collection_name='student_proposals') |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
67 |
|
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
68 |
#: 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
|
69 |
#: should be assigned a project slot. |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
70 |
score = db.IntegerProperty(required=True, default=0) |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
71 |
|
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
72 |
#: the status of this proposal |
1421
7602d41f0ed8
Made some changes to StudentProposal.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1412
diff
changeset
|
73 |
#: new : the proposal has not been ranked/scored yet |
1412
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
74 |
#: 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
|
75 |
#: 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
|
76 |
#: 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
|
77 |
#: does not want this proposal. |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
78 |
#: invalid: the student or developer marked this as an invalid proposal. |
1421
7602d41f0ed8
Made some changes to StudentProposal.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1412
diff
changeset
|
79 |
status = db.StringProperty(required=True, default='new', |
7602d41f0ed8
Made some changes to StudentProposal.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1412
diff
changeset
|
80 |
choices=['new', 'pending', 'accepted', 'rejected', 'invalid']) |
1412
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
81 |
|
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
82 |
#: organization to which this proposal is directed |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
83 |
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
|
84 |
required=True, collection_name='student_proposals') |
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 |
#: 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
|
87 |
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
|
88 |
required=True, collection_name='student_proposals') |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
89 |
|
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
90 |
#: date when the proposal was created |
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
91 |
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
|
92 |
|
fa274dd2f476
First go at the student proposal model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
93 |
#: date when the proposal was last modified, should be set manually on edit |
1421
7602d41f0ed8
Made some changes to StudentProposal.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1412
diff
changeset
|
94 |
last_modified_on = db.DateTimeProperty(required=True, auto_now_add=True) |