3 # Copyright 2008 the Melange authors.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 """This module contains the Program Model.
21 '"Sverre Rabbelier" <sverre@rabbelier.nl>',
25 from google
.appengine
.ext
import db
27 from django
.utils
.translation
import ugettext
29 import soc
.models
.presence
30 import soc
.models
.timeline
33 class Program(soc
.models
.presence
.Presence
):
34 """The Program model, representing a Program ran by a Sponsor.
37 #: Required field storing name of the group.
38 name
= db
.StringProperty(required
=True,
39 verbose_name
=ugettext('Name'))
40 name
.help_text
= ugettext('Complete, formal name of the program.')
41 name
.example_text
= ugettext(
42 '<small><i>e.g.</i></small> <tt>Google Summer of Code 2009</tt>')
44 #: Required field storing short name of the group.
45 #: It can be used for displaying group as sidebar menu item.
46 short_name
= db
.StringProperty(required
=True,
47 verbose_name
=ugettext('Short name'))
48 short_name
.help_text
= ugettext('Short name used for sidebar menu')
49 short_name
.example_text
= ugettext(
50 '<small><i>e.g.</i></small> <tt>GSoC 2009</tt>')
52 #: Optional field used to relate it to other programs
53 #: For example, GSoC would be a group label for GSoC2008/GSoC2009
54 group_label
= db
.StringProperty(
55 verbose_name
=ugettext('Group label'))
56 group_label
.help_text
= ugettext(
57 'Optional name used to relate this program to others.')
58 group_label
.example_text
= ugettext(
59 '<small><i>e.g.</i></small> <tt>GSoC</tt>')
61 #: Required field storing description of the group.
62 description
= db
.TextProperty(required
=True,
63 verbose_name
=ugettext('Description'))
64 description
.example_text
= ugettext(
65 '<small><i>for example:</i></small><br>'
66 '<tt><b>GSoC 2009</b> is the <i>Google Summer of Code</i>,'
67 ' but in <u>2009</u>!</tt><br><br>'
68 '<small><i>(rich text formatting is supported)</i></small>')
70 #: Message displayed at the top of the accepted organizations page.
71 accepted_orgs_msg
= db
.TextProperty(required
=False,
72 verbose_name
=ugettext('Accepted Organizations Message'))
73 accepted_orgs_msg
.example_text
= ugettext(
74 '<small><i>for example:</i></small><br>'
75 '<tt>Students who wish to participate can find out more about'
76 ' each mentoring organization below.</tt><br><br>'
77 '<small><i>(rich text formatting is supported)</i></small>')
79 #: Required field storing application/tasks limit of the program.
80 apps_tasks_limit
= db
.IntegerProperty(required
=True,
81 verbose_name
=ugettext('Application/Tasks Limit'))
82 apps_tasks_limit
.example_text
= ugettext(
83 '<small><i>e.g.</i></small> '
84 '<tt><b>20</b> is the student applications limit for <i>Google Summer '
85 'of Code</i>, but <b>1</b> is the tasks limit that the student can work '
86 'on at the same time during <i>GHOP</i></tt>')
88 #: Optional field storing minimum slots per organization
89 min_slots
= db
.IntegerProperty(required
=False, default
=2,
90 verbose_name
=ugettext('Min slots per org'))
91 min_slots
.help_text
= ugettext(
92 'The amount of slots each org should get at the very least')
94 #: Optional field storing maximum slots per organization
95 max_slots
= db
.IntegerProperty(required
=False, default
=50,
96 verbose_name
=ugettext('Max slots per org'))
97 max_slots
.help_text
= ugettext(
98 'The amount of slots each organization should get at most')
100 #: Required field storing slots limit of the program.
101 slots
= db
.IntegerProperty(required
=True,
102 verbose_name
=ugettext('Slots'))
103 slots
.example_text
= ugettext(
104 '<small><i>e.g.</i></small> '
105 '<tt><b>500</b> might be an amount of slots for <i>Google Summer '
106 'of Code</i>, which indicates how many students can be accepted '
107 'to the program.<br>For <i>GHOP</i> this indicates how '
108 'many tasks can be completed.</tt>')
110 #: Optional field storing the allocation of slots for this program
111 slots_allocation
= db
.TextProperty(required
=False,
112 verbose_name
=ugettext('the allocation of slots'))
114 #: Required field storing the type of workflow this program has
115 workflow
= db
.StringProperty(required
=True,
116 choices
=['gsoc', 'ghop'],
117 verbose_name
= ugettext('Workflow type'))
118 workflow
.example_text
= ugettext(
119 '<tt><b>Project-based</b> for GSoC workflow type,<br>'
120 '<b>Task-based</b> for GHOP workflow type.</tt>')
122 #: Required 1:1 relationship indicating the Program the Timeline
124 timeline
= db
.ReferenceProperty(reference_class
=soc
.models
.timeline
.Timeline
,
125 required
=True, collection_name
="program",
126 verbose_name
=ugettext('Timeline'))
128 #: Whether the slots allocations are visible
129 allocations_visible
= db
.BooleanProperty(default
=False,
130 verbose_name
=ugettext('Slot allocations visible'))
131 allocations_visible
.help_text
= ugettext(
132 'Field used to indicate if the slot allocations should be visible.')
134 #: Document reference property used for the Org Admin Agreement
135 org_admin_agreement
= db
.ReferenceProperty(
136 reference_class
=soc
.models
.document
.Document
,
137 verbose_name
=ugettext('Organization Admin Agreement'),
138 collection_name
='org_admin_agreement')
139 org_admin_agreement
.help_text
= ugettext(
140 'Document containing optional Mentor Agreement for participating as a '
141 'Organization admin.')
143 #: Document reference property used for the Mentor Agreement
144 mentor_agreement
= db
.ReferenceProperty(
145 reference_class
=soc
.models
.document
.Document
,
146 verbose_name
=ugettext('Mentor Agreement'),
147 collection_name
='mentor_agreement')
148 mentor_agreement
.help_text
= ugettext(
149 'Document containing optional Mentor Agreement for participating as a '
152 #: Document reference property used for the Student Agreement
153 student_agreement
= db
.ReferenceProperty(
154 reference_class
=soc
.models
.document
.Document
,
155 verbose_name
=ugettext('Student Agreement'),
156 collection_name
='student_agreement')
157 student_agreement
.help_text
= ugettext(
158 'Document containing optional Student Agreement for participating as a '
161 #: Status of the program
162 #: Invisible: Program Stealth-Mode Visible to Hosts and Devs only
163 #: Visible: Visible to everyone.
164 #: Inactive: Not visible in sidebar but can be reached for date retention
165 #: Invalid: Not visible or editable by anyone
166 status
= db
.StringProperty(required
=True, default
='invisible',
167 verbose_name
=ugettext('Program Status'),
168 choices
=['invisible', 'visible', 'inactive', 'invalid'])
169 status
.example_text
= ugettext(
170 '<tt>Invisible: Program Stealth-Mode Visible to Hosts and Devs only.<br/>'
171 'Visible: Visible to everyone.<br/>'
172 'Inactive: Not visible in sidebar, not editable.<br/>'
173 'Invalid: Not visible or editable by anyone.</tt>')