author | Lennard de Rijk <ljvderijk@gmail.com> |
Tue, 24 Feb 2009 19:43:51 +0000 | |
changeset 1484 | 6b00a2a43eaf |
parent 1433 | 4724e3b99702 |
child 1526 | 5c31184594a5 |
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 |
|
32 |
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
|
33 |
from soc.views.helper import params as params_helper |
1137 | 34 |
from soc.views.helper import widgets |
35 |
from soc.views.models import organization as org_view |
|
36 |
from soc.views.models import role |
|
37 |
||
38 |
import soc.logic.models.mentor |
|
39 |
import soc.logic.models.org_admin |
|
40 |
||
41 |
||
42 |
class View(role.View): |
|
43 |
"""View methods for the Organization Mentors model. |
|
44 |
""" |
|
45 |
||
46 |
def __init__(self, params=None): |
|
47 |
"""Defines the fields and methods required for the base View class |
|
48 |
to provide the user with list, public, create, edit and delete views. |
|
49 |
||
50 |
Params: |
|
51 |
params: a dict with params for this View |
|
52 |
""" |
|
53 |
||
54 |
rights = access.Checker(params) |
|
55 |
rights['create'] = ['checkIsDeveloper'] |
|
1248
f318538394d9
Rename checkHasActiveRole to checkHasActiveRoleForScope
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1203
diff
changeset
|
56 |
rights['edit'] = [('checkHasActiveRoleForScope', soc.logic.models.mentor.logic)] |
1137 | 57 |
rights['delete'] = ['checkIsDeveloper'] |
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
|
58 |
rights['invite'] = [('checkHasActiveRoleForScope', |
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
|
59 |
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
|
60 |
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
|
61 |
'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
|
62 |
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
|
63 |
('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
|
64 |
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
|
65 |
('checkHasActiveRoleForScope', soc.logic.models.org_admin.logic), |
1137 | 66 |
('checkCanProcessRequest', 'mentor')] |
67 |
rights['manage'] = [ |
|
1184
bd9c6101d41d
Use .logic in checkIsAllowedToManageRole at the caller
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1163
diff
changeset
|
68 |
('checkIsAllowedToManageRole', [soc.logic.models.mentor.logic, |
bd9c6101d41d
Use .logic in checkIsAllowedToManageRole at the caller
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1163
diff
changeset
|
69 |
soc.logic.models.org_admin.logic])] |
1137 | 70 |
|
71 |
new_params = {} |
|
72 |
new_params['logic'] = soc.logic.models.mentor.logic |
|
73 |
new_params['group_logic'] = org_logic.logic |
|
74 |
new_params['group_view'] = org_view.view |
|
75 |
new_params['rights'] = rights |
|
76 |
||
77 |
new_params['scope_view'] = org_view |
|
78 |
||
79 |
new_params['name'] = "Mentor" |
|
80 |
new_params['module_name'] = "mentor" |
|
81 |
new_params['sidebar_grouping'] = 'Organizations' |
|
82 |
||
1387
857e6cc8ebc1
Added required program property to org_admin and mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1386
diff
changeset
|
83 |
new_params['extra_dynaexclude'] = ['agreed_to_tos', 'program'] |
1137 | 84 |
|
1433
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
85 |
new_params['create_dynafields'] = [ |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
86 |
{'name': 'scope_path', |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
87 |
'base': forms.fields.CharField, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
88 |
'widget': forms.HiddenInput, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
89 |
'required': True, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
90 |
}, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
91 |
{'name': 'mentor_agreement', |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
92 |
'base': forms.fields.CharField, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
93 |
'required': False, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
94 |
'widget': widgets.AgreementField, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
95 |
'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
|
96 |
}, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
97 |
{'name': 'agreed_to_mentor_agreement', |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
98 |
'base': forms.fields.BooleanField, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
99 |
'initial': False, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
100 |
'required':True, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
101 |
'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
|
102 |
'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
|
103 |
}, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
104 |
] |
1284
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
105 |
|
1137 | 106 |
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
|
107 |
new_params['show_in_roles_overview'] = True |
1137 | 108 |
|
109 |
params = dicts.merge(params, new_params) |
|
110 |
||
111 |
super(View, self).__init__(params=params) |
|
112 |
||
113 |
# register the role with the group_view |
|
114 |
params['group_view'].registerRole(params['module_name'], self) |
|
115 |
||
116 |
# 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
|
117 |
dynafields = [ |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
118 |
{'name': 'link_id', |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
119 |
'base': forms.CharField, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
120 |
'widget': widgets.ReadOnlyInput(), |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
121 |
'required': False, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
122 |
}, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
123 |
{'name': 'mentor_agreement', |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
124 |
'base': forms.fields.Field, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
125 |
'required': False, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
126 |
'widget': widgets.AgreementField, |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
127 |
'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
|
128 |
}, |
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 |
dynaproperties = params_helper.getDynaFields(dynafields) |
1137 | 132 |
|
133 |
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
|
134 |
dynaform=self._params['create_form'], |
4724e3b99702
Convert mentor.py to use DynaFields as an example
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
135 |
dynaproperties=dynaproperties) |
1137 | 136 |
|
137 |
params['invited_create_form'] = invited_create_form |
|
138 |
||
139 |
def _editPost(self, request, entity, fields): |
|
140 |
"""See base.View._editPost(). |
|
141 |
""" |
|
142 |
if not entity: |
|
143 |
fields['user'] = fields['link_id'] |
|
144 |
fields['link_id'] = fields['user'].link_id |
|
145 |
||
1387
857e6cc8ebc1
Added required program property to org_admin and mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1386
diff
changeset
|
146 |
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
|
147 |
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
|
148 |
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
|
149 |
|
1284
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
150 |
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
|
151 |
|
1137 | 152 |
super(View, self)._editPost(request, entity, fields) |
153 |
||
154 |
def _acceptInvitePost(self, fields, request, context, params, **kwargs): |
|
155 |
"""Fills in the fields that were missing in the invited_created_form. |
|
156 |
||
157 |
For params see base.View._acceptInvitePost() |
|
158 |
""" |
|
1284
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
159 |
|
1137 | 160 |
# fill in the appropriate fields that were missing in the form |
161 |
fields['user'] = fields['link_id'] |
|
162 |
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
|
163 |
fields['agreed_to_tos'] = fields['agreed_to_mentor_agreement'] |
1137 | 164 |
|
1387
857e6cc8ebc1
Added required program property to org_admin and mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1386
diff
changeset
|
165 |
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
|
166 |
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
|
167 |
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
|
168 |
|
1284
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
169 |
def _editGet(self, request, entity, form): |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
170 |
"""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
|
171 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
172 |
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
|
173 |
For params see base.View._editGet(). |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
174 |
""" |
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 |
if entity.agreed_to_tos: |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
177 |
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
|
178 |
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
|
179 |
required=True) |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
180 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
181 |
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
|
182 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
183 |
def _editContext(self, request, context): |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
184 |
"""See base.View._editContext. |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
185 |
""" |
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 |
entity = context['entity'] |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
188 |
form = context['form'] |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
189 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
190 |
if 'scope_path' in form.initial: |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
191 |
scope_path = form.initial['scope_path'] |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
192 |
elif 'scope_path' in request.POST: |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
193 |
# TODO: do this nicely |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
194 |
scope_path = request.POST['scope_path'] |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
195 |
else: |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
196 |
# TODO: is this always sufficient? |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
197 |
form.fields['mentor_agreement'] = None |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
198 |
return |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
199 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
200 |
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
|
201 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
202 |
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
|
203 |
return |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
204 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
205 |
content = entity.scope.mentor_agreement.content |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
206 |
|
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1248
diff
changeset
|
207 |
form.fields['mentor_agreement'].widget.text = content |
1137 | 208 |
|
209 |
view = View() |
|
210 |
||
211 |
accept_invite = view.acceptInvite |
|
1343
4ba39392c854
Hook up the admin view everywhere
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1307
diff
changeset
|
212 |
admin = view.admin |
1137 | 213 |
create = view.create |
214 |
delete = view.delete |
|
215 |
edit = view.edit |
|
216 |
invite = view.invite |
|
217 |
list = view.list |
|
218 |
manage = view.manage |
|
219 |
process_request = view.processRequest |
|
220 |
request = view.request |
|
221 |
public = view.public |
|
222 |
export = view.export |
|
223 |