author | Lennard de Rijk <ljvderijk@gmail.com> |
Mon, 23 Mar 2009 20:15:17 +0000 | |
changeset 1996 | ae53f21abb9b |
parent 1932 | 08fb1074b665 |
child 2122 | b709f9d1566a |
permissions | -rw-r--r-- |
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 |
|
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
44 |
#: required, text field describing the project |
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 |
|
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
50 |
#: optional, URL which can give more information about this project |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
51 |
additional_info = db.URLProperty(required=False) |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
52 |
additional_info.help_text = ugettext( |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
53 |
'Link to a resource containing more information about this project.') |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
54 |
|
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
55 |
#: A property containing which mentor has been assigned to this project. |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
56 |
#: A project must have a mentor at all times |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
57 |
mentor = db.ReferenceProperty(reference_class=soc.models.mentor.Mentor, |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
58 |
required=True, |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
59 |
collection_name='student_projects') |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
60 |
|
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
61 |
#: the status of this project |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
62 |
#: accepted: This project has been accepted into the program |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
63 |
#: mid_term_passed: This project has passed the midterm evaluation |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
64 |
#: mid_term_failed: This project has failed the midterm evaluation |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
65 |
#: final_failed: This project has failed the final evaluation |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
66 |
#: passed: This project has completed the program successfully |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
67 |
status = db.StringProperty(required=True, default='accepted', |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
68 |
choices=['accepted', 'mid_term_passed', 'mid_term_failed', |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
69 |
'final_failed', 'passed']) |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
70 |
|
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
71 |
#: student which this project is from |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
72 |
student = db.ReferenceProperty( |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
73 |
reference_class=soc.models.student.Student, |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
74 |
required=True, collection_name='student_projects') |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
75 |
|
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
76 |
#: program in which this project has been created |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
77 |
program = db.ReferenceProperty(reference_class=soc.models.program.Program, |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
78 |
required=True, |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
79 |
collection_name='student_projects') |