author | Madhusudan.C.S <madhusudancs@gmail.com> |
Thu, 27 Aug 2009 22:40:26 +0530 | |
changeset 2822 | 387a3b80df05 |
parent 2634 | 6e71545533b6 |
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 |
|
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 |
|
2634
6e71545533b6
Added failed_evaluations property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2574
diff
changeset
|
60 |
#: Optional field storing a feed URL; displayed publicly |
2122
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. |
2634
6e71545533b6
Added failed_evaluations property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2574
diff
changeset
|
68 |
#: A project must have a mentor at all times. |
1932
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 |
2573
f09f317769c4
Changed the StudentProject model to handle a dynamic amount of GradeRecords.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2183
diff
changeset
|
78 |
#: failed: This project has failed an evaluation. |
f09f317769c4
Changed the StudentProject model to handle a dynamic amount of GradeRecords.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2183
diff
changeset
|
79 |
#: completed: This project has completed the program successfully. This |
f09f317769c4
Changed the StudentProject model to handle a dynamic amount of GradeRecords.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2183
diff
changeset
|
80 |
#: should be set automatically when a program has been deemed |
f09f317769c4
Changed the StudentProject model to handle a dynamic amount of GradeRecords.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2183
diff
changeset
|
81 |
#: finished. |
f09f317769c4
Changed the StudentProject model to handle a dynamic amount of GradeRecords.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2183
diff
changeset
|
82 |
#: withdrawn: This project has been withdrawn from the program by a Program |
f09f317769c4
Changed the StudentProject model to handle a dynamic amount of GradeRecords.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2183
diff
changeset
|
83 |
#: Administrator or higher. |
f09f317769c4
Changed the StudentProject model to handle a dynamic amount of GradeRecords.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2183
diff
changeset
|
84 |
#: invalid: This project has been marked as invalid because it was deleted |
2574
402e4a979e77
Minor stylefix to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
85 |
status = db.StringProperty( |
402e4a979e77
Minor stylefix to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
86 |
required=True, default='accepted', |
2573
f09f317769c4
Changed the StudentProject model to handle a dynamic amount of GradeRecords.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2183
diff
changeset
|
87 |
choices=['accepted', 'failed', 'completed', 'withdrawn', 'invalid']) |
f09f317769c4
Changed the StudentProject model to handle a dynamic amount of GradeRecords.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2183
diff
changeset
|
88 |
|
f09f317769c4
Changed the StudentProject model to handle a dynamic amount of GradeRecords.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2183
diff
changeset
|
89 |
#: List of all processed GradingRecords which state a pass for this project. |
f09f317769c4
Changed the StudentProject model to handle a dynamic amount of GradeRecords.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2183
diff
changeset
|
90 |
#: This property can be used to determine how many evaluations someone has |
f09f317769c4
Changed the StudentProject model to handle a dynamic amount of GradeRecords.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2183
diff
changeset
|
91 |
#: passed. And is also used to ensure that a GradingRecord has been |
f09f317769c4
Changed the StudentProject model to handle a dynamic amount of GradeRecords.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2183
diff
changeset
|
92 |
#: processed. |
f09f317769c4
Changed the StudentProject model to handle a dynamic amount of GradeRecords.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2183
diff
changeset
|
93 |
passed_evaluations = db.ListProperty(item_type=db.Key, default=[]) |
1932
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
94 |
|
2634
6e71545533b6
Added failed_evaluations property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2574
diff
changeset
|
95 |
#: List of all processed GradingRecords which state a fail for this project. |
6e71545533b6
Added failed_evaluations property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2574
diff
changeset
|
96 |
#: This is a ListProperty to ensure that the system keeps functioning when |
6e71545533b6
Added failed_evaluations property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2574
diff
changeset
|
97 |
#: manual changes in GradingRecords occur. |
6e71545533b6
Added failed_evaluations property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2574
diff
changeset
|
98 |
failed_evaluations = db.ListProperty(item_type=db.Key, default=[]) |
6e71545533b6
Added failed_evaluations property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2574
diff
changeset
|
99 |
|
2124
ac484d0e4304
Added public_info property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2122
diff
changeset
|
100 |
#: Student which this project is from |
1932
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
101 |
student = db.ReferenceProperty( |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
102 |
reference_class=soc.models.student.Student, |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
103 |
required=True, collection_name='student_projects') |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
104 |
|
2124
ac484d0e4304
Added public_info property to StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2122
diff
changeset
|
105 |
#: Program in which this project has been created |
1932
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
106 |
program = db.ReferenceProperty(reference_class=soc.models.program.Program, |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
107 |
required=True, |
08fb1074b665
Added StudentProject model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
108 |
collection_name='student_projects') |