author | Pawel Solyga <Pawel.Solyga@gmail.com> |
Wed, 04 Mar 2009 21:15:01 +0000 | |
changeset 1655 | ed1df29f4fd9 |
parent 1584 | d8ba8c917f37 |
child 1659 | ed1a0f139a21 |
permissions | -rw-r--r-- |
1137 | 1 |
#!/usr/bin/python2.5 |
2 |
# |
|
1307
091a21cf3627
Update the copyright notice for 2009.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1284
diff
changeset
|
3 |
# Copyright 2009 the Melange authors. |
1137 | 4 |
# |
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 |
|
8 |
# |
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
|
10 |
# |
|
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. |
|
16 |
||
17 |
"""Views for Organization Mentors. |
|
18 |
""" |
|
19 |
||
20 |
__authors__ = [ |
|
21 |
'"Lennard de Rijk" <ljvderijk@gmail.com>' |
|
1284
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
22 |
'"Sverre Rabbelier" <sverre@rabbelier.nl>', |
1137 | 23 |
] |
24 |
||
25 |
||
26 |
from django import forms |
|
1284
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
27 |
from django.utils.translation import ugettext |
1137 | 28 |
|
29 |
from soc.logic import dicts |
|
30 |
from soc.logic.models import organization as org_logic |
|
31 |
from soc.views.helper import access |
|
1583 | 32 |
from soc.views.helper import decorators |
1137 | 33 |
from soc.views.helper import dynaform |
1433
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
34 |
from soc.views.helper import params as params_helper |
1137 | 35 |
from soc.views.helper import widgets |
36 |
from soc.views.models import organization as org_view |
|
37 |
from soc.views.models import role |
|
38 |
||
39 |
import soc.logic.models.mentor |
|
40 |
import soc.logic.models.org_admin |
|
41 |
||
42 |
||
43 |
class View(role.View): |
|
44 |
"""View methods for the Organization Mentors model. |
|
45 |
""" |
|
46 |
||
47 |
def __init__(self, params=None): |
|
48 |
"""Defines the fields and methods required for the base View class |
|
49 |
to provide the user with list, public, create, edit and delete views. |
|
50 |
||
51 |
Params: |
|
52 |
params: a dict with params for this View |
|
53 |
""" |
|
54 |
||
55 |
rights = access.Checker(params) |
|
56 |
rights['create'] = ['checkIsDeveloper'] |
|
1248
f318538394d9
Rename checkHasActiveRole to checkHasActiveRoleForScope
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1203
diff
changeset
|
57 |
rights['edit'] = [('checkHasActiveRoleForScope', soc.logic.models.mentor.logic)] |
1137 | 58 |
rights['delete'] = ['checkIsDeveloper'] |
1526
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1433
diff
changeset
|
59 |
rights['invite'] = [('checkHasActiveRoleForScope', |
1386
0c205ce4e27d
Org admins can now send out invitations and users can now request to become a mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1384
diff
changeset
|
60 |
soc.logic.models.org_admin.logic)] |
1377
101759701e51
Students can not become a mentor or org_admin in the same program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1343
diff
changeset
|
61 |
rights['accept_invite'] = [('checkCanCreateFromRequest', 'mentor'), |
101759701e51
Students can not become a mentor or org_admin in the same program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1343
diff
changeset
|
62 |
'checkIsNotStudentForProgramOfOrg'] |
1386
0c205ce4e27d
Org admins can now send out invitations and users can now request to become a mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1384
diff
changeset
|
63 |
rights['request'] = ['checkIsNotStudentForProgramOfOrg', |
0c205ce4e27d
Org admins can now send out invitations and users can now request to become a mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1384
diff
changeset
|
64 |
('checkCanMakeRequestToGroup', org_logic)] |
0c205ce4e27d
Org admins can now send out invitations and users can now request to become a mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1384
diff
changeset
|
65 |
rights['process_request'] = [ |
0c205ce4e27d
Org admins can now send out invitations and users can now request to become a mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1384
diff
changeset
|
66 |
('checkHasActiveRoleForScope', soc.logic.models.org_admin.logic), |
1137 | 67 |
('checkCanProcessRequest', 'mentor')] |
68 |
rights['manage'] = [ |
|
1184
bd9c6101d41d
Use .logic in checkIsAllowedToManageRole at the caller
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1163
diff
changeset
|
69 |
('checkIsAllowedToManageRole', [soc.logic.models.mentor.logic, |
bd9c6101d41d
Use .logic in checkIsAllowedToManageRole at the caller
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1163
diff
changeset
|
70 |
soc.logic.models.org_admin.logic])] |
1137 | 71 |
|
72 |
new_params = {} |
|
73 |
new_params['logic'] = soc.logic.models.mentor.logic |
|
74 |
new_params['group_logic'] = org_logic.logic |
|
75 |
new_params['group_view'] = org_view.view |
|
76 |
new_params['rights'] = rights |
|
77 |
||
78 |
new_params['scope_view'] = org_view |
|
79 |
||
80 |
new_params['name'] = "Mentor" |
|
81 |
new_params['module_name'] = "mentor" |
|
82 |
new_params['sidebar_grouping'] = 'Organizations' |
|
83 |
||
1387
857e6cc8ebc1
Added required program property to org_admin and mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1386
diff
changeset
|
84 |
new_params['extra_dynaexclude'] = ['agreed_to_tos', 'program'] |
1137 | 85 |
|
1433
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
86 |
new_params['create_dynafields'] = [ |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
87 |
{'name': 'scope_path', |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
88 |
'base': forms.fields.CharField, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
89 |
'widget': forms.HiddenInput, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
90 |
'required': True, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
91 |
}, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
92 |
{'name': 'mentor_agreement', |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
93 |
'base': forms.fields.CharField, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
94 |
'required': False, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
95 |
'widget': widgets.AgreementField, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
96 |
'group': ugettext("5. Terms of Service"), |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
97 |
}, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
98 |
{'name': 'agreed_to_mentor_agreement', |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
99 |
'base': forms.fields.BooleanField, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
100 |
'initial': False, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
101 |
'required':True, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
102 |
'label': ugettext('I agree to the Mentor Agreement'), |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
103 |
'group': ugettext("5. Terms of Service"), |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
104 |
}, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
105 |
] |
1284
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
106 |
|
1137 | 107 |
new_params['allow_requests_and_invites'] = True |
1384
bb22ea156567
Role overview membership is now determined by setting show_in_roles_overview param to true in the view.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1377
diff
changeset
|
108 |
new_params['show_in_roles_overview'] = True |
1137 | 109 |
|
110 |
params = dicts.merge(params, new_params) |
|
111 |
||
112 |
super(View, self).__init__(params=params) |
|
113 |
||
114 |
# register the role with the group_view |
|
115 |
params['group_view'].registerRole(params['module_name'], self) |
|
116 |
||
117 |
# create and store the special form for invited users |
|
1433
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
118 |
dynafields = [ |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
119 |
{'name': 'link_id', |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
120 |
'base': forms.CharField, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
121 |
'widget': widgets.ReadOnlyInput(), |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
122 |
'required': False, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
123 |
}, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
124 |
{'name': 'mentor_agreement', |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
125 |
'base': forms.fields.Field, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
126 |
'required': False, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
127 |
'widget': widgets.AgreementField, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
128 |
'group': ugettext("5. Terms of Service"), |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
129 |
}, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
130 |
] |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
131 |
|
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
132 |
dynaproperties = params_helper.getDynaFields(dynafields) |
1137 | 133 |
|
134 |
invited_create_form = dynaform.extendDynaForm( |
|
1433
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
135 |
dynaform=self._params['create_form'], |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
136 |
dynaproperties=dynaproperties) |
1137 | 137 |
|
138 |
params['invited_create_form'] = invited_create_form |
|
139 |
||
140 |
def _editPost(self, request, entity, fields): |
|
141 |
"""See base.View._editPost(). |
|
142 |
""" |
|
143 |
if not entity: |
|
144 |
fields['user'] = fields['link_id'] |
|
145 |
fields['link_id'] = fields['user'].link_id |
|
146 |
||
1387
857e6cc8ebc1
Added required program property to org_admin and mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1386
diff
changeset
|
147 |
group_logic = params['group_logic'] |
857e6cc8ebc1
Added required program property to org_admin and mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1386
diff
changeset
|
148 |
group_entity = group_logic.getFromKeyName(fields['scope_path']) |
857e6cc8ebc1
Added required program property to org_admin and mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1386
diff
changeset
|
149 |
fields['program'] = group_entity.scope |
857e6cc8ebc1
Added required program property to org_admin and mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1386
diff
changeset
|
150 |
|
1284
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
151 |
fields['agreed_to_tos'] = fields['agreed_to_mentor_agreement'] |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
152 |
|
1137 | 153 |
super(View, self)._editPost(request, entity, fields) |
154 |
||
155 |
def _acceptInvitePost(self, fields, request, context, params, **kwargs): |
|
156 |
"""Fills in the fields that were missing in the invited_created_form. |
|
157 |
||
158 |
For params see base.View._acceptInvitePost() |
|
159 |
""" |
|
1284
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
160 |
|
1137 | 161 |
# fill in the appropriate fields that were missing in the form |
162 |
fields['user'] = fields['link_id'] |
|
163 |
fields['link_id'] = fields['user'].link_id |
|
1284
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
164 |
fields['agreed_to_tos'] = fields['agreed_to_mentor_agreement'] |
1137 | 165 |
|
1387
857e6cc8ebc1
Added required program property to org_admin and mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1386
diff
changeset
|
166 |
group_logic = params['group_logic'] |
857e6cc8ebc1
Added required program property to org_admin and mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1386
diff
changeset
|
167 |
group_entity = group_logic.getFromKeyName(fields['scope_path']) |
857e6cc8ebc1
Added required program property to org_admin and mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1386
diff
changeset
|
168 |
fields['program'] = group_entity.scope |
857e6cc8ebc1
Added required program property to org_admin and mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1386
diff
changeset
|
169 |
|
1284
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
170 |
def _editGet(self, request, entity, form): |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
171 |
"""Sets the content of the agreed_to_tos_on field and replaces. |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
172 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
173 |
Also replaces the agreed_to_tos field with a hidden field when the ToS has been signed. |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
174 |
For params see base.View._editGet(). |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
175 |
""" |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
176 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
177 |
if entity.agreed_to_tos: |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
178 |
form.fields['agreed_to_mentor_agreement'] = forms.fields.BooleanField( |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
179 |
widget=forms.HiddenInput, initial=entity.agreed_to_tos, |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
180 |
required=True) |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
181 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
182 |
super(View, self)._editGet(request, entity, form) |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
183 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
184 |
def _editContext(self, request, context): |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
185 |
"""See base.View._editContext. |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
186 |
""" |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
187 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
188 |
entity = context['entity'] |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
189 |
form = context['form'] |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
190 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
191 |
if 'scope_path' in form.initial: |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
192 |
scope_path = form.initial['scope_path'] |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
193 |
elif 'scope_path' in request.POST: |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
194 |
# TODO: do this nicely |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
195 |
scope_path = request.POST['scope_path'] |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
196 |
else: |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
197 |
# TODO: is this always sufficient? |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
198 |
form.fields['mentor_agreement'] = None |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
199 |
return |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
200 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
201 |
entity = org_logic.logic.getFromKeyName(scope_path) |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
202 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
203 |
if not (entity and entity.scope and entity.scope.mentor_agreement): |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
204 |
return |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
205 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
206 |
content = entity.scope.mentor_agreement.content |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
207 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
208 |
form.fields['mentor_agreement'].widget.text = content |
1137 | 209 |
|
210 |
view = View() |
|
211 |
||
1584
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1583
diff
changeset
|
212 |
accept_invite = decorators.view(view.acceptInvite) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1583
diff
changeset
|
213 |
admin = decorators.view(view.admin) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1583
diff
changeset
|
214 |
create = decorators.view(view.create) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1583
diff
changeset
|
215 |
delete = decorators.view(view.delete) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1583
diff
changeset
|
216 |
edit = decorators.view(view.edit) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1583
diff
changeset
|
217 |
invite = decorators.view(view.invite) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1583
diff
changeset
|
218 |
list = decorators.view(view.list) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1583
diff
changeset
|
219 |
manage = decorators.view(view.manage) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1583
diff
changeset
|
220 |
process_request = decorators.view(view.processRequest) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1583
diff
changeset
|
221 |
request = decorators.view(view.request) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1583
diff
changeset
|
222 |
public = decorators.view(view.public) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1583
diff
changeset
|
223 |
export = decorators.view(view.export) |
1137 | 224 |