author | Lennard de Rijk <ljvderijk@gmail.com> |
Thu, 30 Jul 2009 13:54:47 +0200 | |
changeset 2694 | b8f083157e33 |
parent 2573 | f09f317769c4 |
child 2699 | 3b11f9c24d65 |
permissions | -rw-r--r-- |
682 | 1 |
#!/usr/bin/python2.5 |
2 |
# |
|
1308
35b75ffcbb37
Partially reverted "Update the copyright notice for 2009."
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1307
diff
changeset
|
3 |
# Copyright 2008 the Melange authors. |
682 | 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 Organizations. |
|
18 |
""" |
|
19 |
||
20 |
__authors__ = [ |
|
2250
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
21 |
'"Madhusudan.C.S" <madhusudancs@gmail.com>', |
1599
b56976cac36b
Add myself to authors on this file, and allow my whitespace cleanup hook to cleanup whitespace.
Augie Fackler <durin42@gmail.com>
parents:
1598
diff
changeset
|
22 |
'"Augie Fackler" <durin42@gmail.com>', |
682 | 23 |
'"Sverre Rabbelier" <sverre@rabbelier.nl>', |
1126
4fc86db70a76
Added organization view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1079
diff
changeset
|
24 |
'"Lennard de Rijk" <ljvderijk@gmail.com>', |
682 | 25 |
] |
26 |
||
27 |
||
1685
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
28 |
import itertools |
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
29 |
|
682 | 30 |
from django import forms |
2250
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
31 |
from django.utils import simplejson |
1641
c2201decd4b4
Some style fixes, removal of unused imports and add ugettext where it was missing in soc.views.models.organization module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1605
diff
changeset
|
32 |
from django.utils.translation import ugettext |
682 | 33 |
|
690
14e9f484412c
Fix imports sorting in soc.views.models.organization.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
682
diff
changeset
|
34 |
from soc.logic import cleaning |
682 | 35 |
from soc.logic import dicts |
1344
d94410538f8e
Redirect to the admin view in listPublic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1343
diff
changeset
|
36 |
from soc.logic import accounts |
2146
57c74ce47fa3
Added Manage Student Projects item to the organization menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2129
diff
changeset
|
37 |
from soc.logic.helper import timeline as timeline_helper |
1489
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
38 |
from soc.logic.models import mentor as mentor_logic |
1266
e8feadcbc47f
Changed the access checks for organization.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1264
diff
changeset
|
39 |
from soc.logic.models import organization as org_logic |
e8feadcbc47f
Changed the access checks for organization.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1264
diff
changeset
|
40 |
from soc.logic.models import org_admin as org_admin_logic |
1154
77276e2c46f7
Implement the last step in the org application process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1126
diff
changeset
|
41 |
from soc.logic.models import org_app as org_app_logic |
1526
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
42 |
from soc.logic.models import user as user_logic |
1567
b5589e656ed1
Member template in organization is now called Contributor Template.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1526
diff
changeset
|
43 |
from soc.views import helper |
1598
a55296590875
Fix a missing import reported in #melange.
Augie Fackler <durin42@gmail.com>
parents:
1596
diff
changeset
|
44 |
from soc.views import out_of_band |
1126
4fc86db70a76
Added organization view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1079
diff
changeset
|
45 |
from soc.views.helper import access |
1325
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
46 |
from soc.views.helper import decorators |
1154
77276e2c46f7
Implement the last step in the org application process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1126
diff
changeset
|
47 |
from soc.views.helper import dynaform |
1325
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
48 |
from soc.views.helper import lists |
682 | 49 |
from soc.views.helper import redirects |
1154
77276e2c46f7
Implement the last step in the org application process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1126
diff
changeset
|
50 |
from soc.views.helper import widgets |
682 | 51 |
from soc.views.models import group |
52 |
||
53 |
import soc.models.organization |
|
54 |
import soc.logic.models.organization |
|
55 |
||
56 |
class View(group.View): |
|
57 |
"""View methods for the Organization model. |
|
58 |
""" |
|
59 |
||
2121
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
60 |
DEF_ACCEPTED_PROJECTS_MSG_FMT = ugettext("These projects have" |
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
61 |
" been accepted into %s. You can learn more about" |
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
62 |
" each project by visiting the links below.") |
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
63 |
|
682 | 64 |
def __init__(self, params=None): |
65 |
"""Defines the fields and methods required for the base View class |
|
66 |
to provide the user with list, public, create, edit and delete views. |
|
67 |
||
68 |
Params: |
|
69 |
original_params: a dict with params for this View |
|
70 |
""" |
|
2097
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
71 |
|
2076
1cd180cc56c9
Style fixes and removal of unused imports in soc.views.models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
2037
diff
changeset
|
72 |
from soc.views.models import program as program_view |
2097
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
73 |
|
1126
4fc86db70a76
Added organization view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1079
diff
changeset
|
74 |
rights = access.Checker(params) |
1325
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
75 |
rights['any_access'] = ['allow'] |
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
76 |
rights['show'] = ['allow'] |
1126
4fc86db70a76
Added organization view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1079
diff
changeset
|
77 |
rights['create'] = ['checkIsDeveloper'] |
1526
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
78 |
rights['edit'] = [('checkHasActiveRoleForKeyFieldsAsScope', |
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
79 |
org_admin_logic.logic,), |
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
80 |
('checkGroupIsActiveForLinkId', org_logic.logic)] |
1126
4fc86db70a76
Added organization view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1079
diff
changeset
|
81 |
rights['delete'] = ['checkIsDeveloper'] |
4fc86db70a76
Added organization view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1079
diff
changeset
|
82 |
rights['home'] = ['allow'] |
1325
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
83 |
rights['public_list'] = ['allow'] |
1405
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
84 |
rights['apply_mentor'] = ['checkIsUser'] |
1526
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
85 |
rights['list_requests'] = [('checkHasActiveRoleForKeyFieldsAsScope', |
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
86 |
org_admin_logic.logic)] |
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
87 |
rights['list_roles'] = [('checkHasActiveRoleForKeyFieldsAsScope', |
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
88 |
org_admin_logic.logic)] |
1266
e8feadcbc47f
Changed the access checks for organization.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1264
diff
changeset
|
89 |
rights['applicant'] = [('checkIsApplicationAccepted', |
e8feadcbc47f
Changed the access checks for organization.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1264
diff
changeset
|
90 |
org_app_logic.logic)] |
1489
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
91 |
rights['list_proposals'] = [('checkHasAny', [ |
1605
df05cd289b2f
Fixed two bugs introduced in r2160.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1600
diff
changeset
|
92 |
[('checkHasActiveRoleForKeyFieldsAsScope', [org_admin_logic.logic]), |
df05cd289b2f
Fixed two bugs introduced in r2160.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1600
diff
changeset
|
93 |
('checkHasActiveRoleForKeyFieldsAsScope', [mentor_logic.logic])] |
1489
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
94 |
])] |
1126
4fc86db70a76
Added organization view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1079
diff
changeset
|
95 |
|
682 | 96 |
new_params = {} |
97 |
new_params['logic'] = soc.logic.models.organization.logic |
|
1325
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
98 |
new_params['rights'] = rights |
682 | 99 |
|
100 |
new_params['scope_view'] = program_view |
|
101 |
new_params['scope_redirect'] = redirects.getCreateRedirect |
|
102 |
||
103 |
new_params['name'] = "Organization" |
|
104 |
new_params['url_name'] = "org" |
|
1303
08433090cff8
Add prefix filtering and refactored program field generation
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1284
diff
changeset
|
105 |
new_params['document_prefix'] = "org" |
1126
4fc86db70a76
Added organization view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1079
diff
changeset
|
106 |
new_params['sidebar_grouping'] = 'Organizations' |
682 | 107 |
|
1126
4fc86db70a76
Added organization view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1079
diff
changeset
|
108 |
new_params['public_template'] = 'soc/organization/public.html' |
4fc86db70a76
Added organization view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1079
diff
changeset
|
109 |
new_params['list_row'] = 'soc/organization/list/row.html' |
4fc86db70a76
Added organization view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1079
diff
changeset
|
110 |
new_params['list_heading'] = 'soc/organization/list/heading.html' |
2121
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
111 |
new_params['home_template'] = 'soc/organization/home.html' |
1126
4fc86db70a76
Added organization view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1079
diff
changeset
|
112 |
|
1154
77276e2c46f7
Implement the last step in the org application process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1126
diff
changeset
|
113 |
new_params['application_logic'] = org_app_logic |
77276e2c46f7
Implement the last step in the org application process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1126
diff
changeset
|
114 |
new_params['group_applicant_url'] = True |
1325
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
115 |
new_params['sans_link_id_public_list'] = True |
1154
77276e2c46f7
Implement the last step in the org application process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1126
diff
changeset
|
116 |
|
2129
f6ca1647bff7
Use slots allocated instead of adjustment in slots view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2121
diff
changeset
|
117 |
new_params['extra_dynaexclude'] = ['slots', 'slots_calculated', |
f6ca1647bff7
Use slots allocated instead of adjustment in slots view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2121
diff
changeset
|
118 |
'nr_applications', 'nr_mentors'] |
1760
393891d794e2
Hide 'slots' and add 'slots_desired'
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1702
diff
changeset
|
119 |
|
1405
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
120 |
patterns = [] |
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
121 |
|
1702 | 122 |
patterns += [ |
123 |
(r'^%(url_name)s/(?P<access_type>apply_mentor)/%(scope)s$', |
|
1599
b56976cac36b
Add myself to authors on this file, and allow my whitespace cleanup hook to cleanup whitespace.
Augie Fackler <durin42@gmail.com>
parents:
1598
diff
changeset
|
124 |
'soc.views.models.%(module_name)s.apply_mentor', |
1489
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
125 |
"List of all %(name_plural)s you can apply to"), |
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
126 |
(r'^%(url_name)s/(?P<access_type>list_proposals)/%(key_fields)s$', |
1599
b56976cac36b
Add myself to authors on this file, and allow my whitespace cleanup hook to cleanup whitespace.
Augie Fackler <durin42@gmail.com>
parents:
1598
diff
changeset
|
127 |
'soc.views.models.%(module_name)s.list_proposals', |
1702 | 128 |
"List of all Student Proposals for this %(name)s"), |
129 |
] |
|
1405
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
130 |
|
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
131 |
new_params['extra_django_patterns'] = patterns |
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
132 |
|
1875
69d60793092a
Specify the type of Link ID used
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1838
diff
changeset
|
133 |
new_params['create_dynafields'] = [ |
69d60793092a
Specify the type of Link ID used
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1838
diff
changeset
|
134 |
{'name': 'link_id', |
69d60793092a
Specify the type of Link ID used
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1838
diff
changeset
|
135 |
'base': forms.fields.CharField, |
69d60793092a
Specify the type of Link ID used
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1838
diff
changeset
|
136 |
'label': 'Organization Link ID', |
69d60793092a
Specify the type of Link ID used
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1838
diff
changeset
|
137 |
}, |
69d60793092a
Specify the type of Link ID used
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1838
diff
changeset
|
138 |
] |
69d60793092a
Specify the type of Link ID used
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1838
diff
changeset
|
139 |
|
1430
ff8cc6b15e6a
Rename dynafields to dynaproperties
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1406
diff
changeset
|
140 |
new_params['create_extra_dynaproperties'] = { |
682 | 141 |
'scope_path': forms.CharField(widget=forms.HiddenInput, |
142 |
required=True), |
|
1683
866667e9343d
Make org description use TinyMCE
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1676
diff
changeset
|
143 |
'description': forms.fields.CharField( |
866667e9343d
Make org description use TinyMCE
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1676
diff
changeset
|
144 |
widget=helper.widgets.FullTinyMCE( |
866667e9343d
Make org description use TinyMCE
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1676
diff
changeset
|
145 |
attrs={'rows': 25, 'cols': 100})), |
1567
b5589e656ed1
Member template in organization is now called Contributor Template.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1526
diff
changeset
|
146 |
'contrib_template': forms.fields.CharField( |
b5589e656ed1
Member template in organization is now called Contributor Template.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1526
diff
changeset
|
147 |
widget=helper.widgets.FullTinyMCE( |
b5589e656ed1
Member template in organization is now called Contributor Template.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1526
diff
changeset
|
148 |
attrs={'rows': 25, 'cols': 100})), |
1683
866667e9343d
Make org description use TinyMCE
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1676
diff
changeset
|
149 |
'clean_description': cleaning.clean_html_content('description'), |
2076
1cd180cc56c9
Style fixes and removal of unused imports in soc.views.models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
2037
diff
changeset
|
150 |
'clean_contrib_template': cleaning.clean_html_content( |
1cd180cc56c9
Style fixes and removal of unused imports in soc.views.models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
2037
diff
changeset
|
151 |
'contrib_template'), |
1391
09a95e57caa7
Added a missing cleaner to org idea list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1344
diff
changeset
|
152 |
'clean_ideas': cleaning.clean_url('ideas'), |
1221
0130e63704ac
Remove extra whitespaces in soc.views.models.organization module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1205
diff
changeset
|
153 |
'clean': cleaning.validate_new_group('link_id', 'scope_path', |
1325
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
154 |
soc.logic.models.organization, org_app_logic) |
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
155 |
} |
1205
2e88261aba72
Added validate_new_group to cleaning and removed clean_new_club_link_id.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1154
diff
changeset
|
156 |
|
1430
ff8cc6b15e6a
Rename dynafields to dynaproperties
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1406
diff
changeset
|
157 |
new_params['edit_extra_dynaproperties'] = { |
1700
599a5ff8f422
Clean document references
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1685
diff
changeset
|
158 |
'clean': cleaning.clean_refs(new_params, ['home_link_id']) |
599a5ff8f422
Clean document references
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1685
diff
changeset
|
159 |
} |
682 | 160 |
|
161 |
params = dicts.merge(params, new_params) |
|
162 |
||
163 |
super(View, self).__init__(params=params) |
|
164 |
||
1154
77276e2c46f7
Implement the last step in the org application process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1126
diff
changeset
|
165 |
# create and store the special form for applicants |
77276e2c46f7
Implement the last step in the org application process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1126
diff
changeset
|
166 |
updated_fields = { |
77276e2c46f7
Implement the last step in the org application process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1126
diff
changeset
|
167 |
'link_id': forms.CharField(widget=widgets.ReadOnlyInput(), |
77276e2c46f7
Implement the last step in the org application process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1126
diff
changeset
|
168 |
required=False), |
1325
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
169 |
'clean_link_id': cleaning.clean_link_id('link_id') |
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
170 |
} |
1154
77276e2c46f7
Implement the last step in the org application process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1126
diff
changeset
|
171 |
|
77276e2c46f7
Implement the last step in the org application process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1126
diff
changeset
|
172 |
applicant_create_form = dynaform.extendDynaForm( |
77276e2c46f7
Implement the last step in the org application process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1126
diff
changeset
|
173 |
dynaform = self._params['create_form'], |
1430
ff8cc6b15e6a
Rename dynafields to dynaproperties
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1406
diff
changeset
|
174 |
dynaproperties = updated_fields) |
1154
77276e2c46f7
Implement the last step in the org application process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1126
diff
changeset
|
175 |
|
2177
e2c193e1f631
Do not rely on dicts.merge to change target
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2155
diff
changeset
|
176 |
self._params['applicant_create_form'] = applicant_create_form |
1154
77276e2c46f7
Implement the last step in the org application process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1126
diff
changeset
|
177 |
|
1325
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
178 |
@decorators.merge_params |
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
179 |
@decorators.check_access |
1405
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
180 |
def applyMentor(self, request, access_type, |
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
181 |
page_name=None, params=None, **kwargs): |
1599
b56976cac36b
Add myself to authors on this file, and allow my whitespace cleanup hook to cleanup whitespace.
Augie Fackler <durin42@gmail.com>
parents:
1598
diff
changeset
|
182 |
"""Shows a list of all organizations and you can choose one to |
1405
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
183 |
apply to become a mentor. |
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
184 |
|
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
185 |
Args: |
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
186 |
request: the standard Django HTTP request object |
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
187 |
access_type : the name of the access type which should be checked |
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
188 |
page_name: the page name displayed in templates as page and header title |
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
189 |
params: a dict with params for this View |
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
190 |
kwargs: the Key Fields for the specified entity |
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
191 |
""" |
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
192 |
|
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
193 |
list_params = params.copy() |
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
194 |
list_params['list_action'] = (redirects.getRequestRedirectForRole, 'mentor') |
1641
c2201decd4b4
Some style fixes, removal of unused imports and add ugettext where it was missing in soc.views.models.organization module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1605
diff
changeset
|
195 |
list_params['list_description'] = ugettext('Choose an Organization which ' |
1405
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
196 |
'you want to become a Mentor for.') |
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
197 |
|
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
198 |
filter = {'scope_path': kwargs['scope_path'], |
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
199 |
'status' : 'active'} |
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
200 |
|
1599
b56976cac36b
Add myself to authors on this file, and allow my whitespace cleanup hook to cleanup whitespace.
Augie Fackler <durin42@gmail.com>
parents:
1598
diff
changeset
|
201 |
return self.list(request, access_type, |
1405
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
202 |
page_name, params=list_params, filter=filter) |
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
203 |
|
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
204 |
@decorators.merge_params |
43b482f48b12
Added apply as a mentor view which lists all orgs for a given program.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1391
diff
changeset
|
205 |
@decorators.check_access |
1489
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
206 |
def listProposals(self, request, access_type, |
1491
acf7e32de8ca
Style fixes in student_proposal and organization view.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1490
diff
changeset
|
207 |
page_name=None, params=None, **kwargs): |
1489
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
208 |
"""Lists all proposals for the organization given in kwargs. |
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
209 |
|
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
210 |
For params see base.View.public(). |
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
211 |
""" |
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
212 |
|
1685
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
213 |
from soc.logic.models.ranker_root import logic as ranker_root_logic |
2220
6007ed887fee
Fixed wrong import for list proposals view.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2212
diff
changeset
|
214 |
from soc.logic.models.student_proposal import logic as sp_logic |
1685
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
215 |
from soc.models import student_proposal |
1928
8001eee3160f
The org list proposals page now shows the amount of assigned slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1920
diff
changeset
|
216 |
from soc.views.helper import list_info as list_info_helper |
1489
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
217 |
from soc.views.models import student_proposal as student_proposal_view |
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
218 |
|
1668
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
219 |
try: |
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
220 |
org_entity = self._logic.getFromKeyFieldsOr404(kwargs) |
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
221 |
except out_of_band.Error, error: |
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
222 |
return helper.responses.errorResponse( |
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
223 |
error, request, template=params['error_public']) |
1489
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
224 |
|
1928
8001eee3160f
The org list proposals page now shows the amount of assigned slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1920
diff
changeset
|
225 |
context = {} |
8001eee3160f
The org list proposals page now shows the amount of assigned slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1920
diff
changeset
|
226 |
context['entity'] = org_entity |
8001eee3160f
The org list proposals page now shows the amount of assigned slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1920
diff
changeset
|
227 |
|
1489
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
228 |
list_params = student_proposal_view.view.getParams().copy() |
1928
8001eee3160f
The org list proposals page now shows the amount of assigned slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1920
diff
changeset
|
229 |
list_params['list_template'] = 'soc/student_proposal/list_for_org.html' |
2103
45a50234e625
Added key_order to student proposal to enable csv export
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2097
diff
changeset
|
230 |
list_params['list_key_order'] = [ |
45a50234e625
Added key_order to student proposal to enable csv export
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2097
diff
changeset
|
231 |
'title', 'abstract', 'content', 'additional_info', 'mentor', |
45a50234e625
Added key_order to student proposal to enable csv export
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2097
diff
changeset
|
232 |
'possible_mentors', 'score', 'status', 'created_on', |
45a50234e625
Added key_order to student proposal to enable csv export
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2097
diff
changeset
|
233 |
'last_modified_on'] |
1668
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
234 |
|
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
235 |
ranked_params = list_params.copy()# ranked proposals |
1685
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
236 |
ranked_params['list_row'] = ('soc/%(module_name)s/list/' |
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
237 |
'detailed_row.html' % list_params) |
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
238 |
ranked_params['list_heading'] = ('soc/%(module_name)s/list/' |
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
239 |
'detailed_heading.html' % list_params) |
1920
0eba9cb1b331
Change the order of student proposals lists for org admins and mentors. Now the new proposals list shows up at the top. Also don't show the list of new proposals if it's empty.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1875
diff
changeset
|
240 |
ranked_params['list_description'] = '%s already under review sent to %s' % ( |
1668
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
241 |
ranked_params['name_plural'], org_entity.name) |
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
242 |
ranked_params['list_action'] = (redirects.getReviewRedirect, ranked_params) |
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
243 |
|
1676
a3c33bef2ea8
Organization Proposals list now correctly sorts.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1668
diff
changeset
|
244 |
# TODO(ljvderijk) once sorting with IN operator is fixed, |
a3c33bef2ea8
Organization Proposals list now correctly sorts.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1668
diff
changeset
|
245 |
# make this list show more |
a3c33bef2ea8
Organization Proposals list now correctly sorts.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1668
diff
changeset
|
246 |
filter = {'org': org_entity, |
a3c33bef2ea8
Organization Proposals list now correctly sorts.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1668
diff
changeset
|
247 |
'status': 'pending'} |
1668
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
248 |
|
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
249 |
# order by descending score |
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
250 |
order = ['-score'] |
1489
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
251 |
|
1668
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
252 |
prop_list = lists.getListContent( |
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
253 |
request, ranked_params, filter, order=order, idx=0) |
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
254 |
|
1685
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
255 |
proposals = prop_list['data'] |
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
256 |
|
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
257 |
# get a list of scores |
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
258 |
scores = [[proposal.score] for proposal in proposals] |
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
259 |
|
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
260 |
# retrieve the ranker |
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
261 |
fields = {'link_id': student_proposal.DEF_RANKER_NAME, |
2093
987913140e31
Indention fix in soc.views.models.organization module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
2076
diff
changeset
|
262 |
'scope': org_entity} |
1685
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
263 |
|
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
264 |
ranker_root = ranker_root_logic.getForFields(fields, unique=True) |
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
265 |
ranker = ranker_root_logic.getRootFromEntity(ranker_root) |
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
266 |
|
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
267 |
# retrieve the ranks for these scores |
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
268 |
ranks = [rank+1 for rank in ranker.FindRanks(scores)] |
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
269 |
|
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
270 |
# link the proposals to the rank |
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
271 |
ranking = dict([i for i in itertools.izip(proposals, ranks)]) |
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
272 |
|
1928
8001eee3160f
The org list proposals page now shows the amount of assigned slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1920
diff
changeset
|
273 |
assigned_proposals = [] |
8001eee3160f
The org list proposals page now shows the amount of assigned slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1920
diff
changeset
|
274 |
|
2076
1cd180cc56c9
Style fixes and removal of unused imports in soc.views.models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
2037
diff
changeset
|
275 |
# only when the program allows allocations |
1cd180cc56c9
Style fixes and removal of unused imports in soc.views.models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
2037
diff
changeset
|
276 |
# to be seen we should color the list |
1928
8001eee3160f
The org list proposals page now shows the amount of assigned slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1920
diff
changeset
|
277 |
if org_entity.scope.allocations_visible: |
2202
f6a1c141f51e
Use proposal key instead of raw proposal
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2201
diff
changeset
|
278 |
assigned_proposals = sp_logic.getProposalsToBeAcceptedForOrg(org_entity) |
1928
8001eee3160f
The org list proposals page now shows the amount of assigned slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1920
diff
changeset
|
279 |
|
8001eee3160f
The org list proposals page now shows the amount of assigned slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1920
diff
changeset
|
280 |
# show the amount of slots assigned on the webpage |
8001eee3160f
The org list proposals page now shows the amount of assigned slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1920
diff
changeset
|
281 |
context['slots_visible'] = True |
8001eee3160f
The org list proposals page now shows the amount of assigned slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1920
diff
changeset
|
282 |
|
2212
4095892a3c99
Removed unneeded imports and variables
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2207
diff
changeset
|
283 |
ranking_keys = dict([(k.key(), v) for k, v in ranking.iteritems()]) |
2202
f6a1c141f51e
Use proposal key instead of raw proposal
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2201
diff
changeset
|
284 |
proposal_keys = [i.key() for i in assigned_proposals] |
f6a1c141f51e
Use proposal key instead of raw proposal
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2201
diff
changeset
|
285 |
|
1928
8001eee3160f
The org list proposals page now shows the amount of assigned slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1920
diff
changeset
|
286 |
# update the prop_list with the ranking and coloring information |
2202
f6a1c141f51e
Use proposal key instead of raw proposal
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2201
diff
changeset
|
287 |
prop_list['info'] = (list_info_helper.getStudentProposalInfo(ranking_keys, |
f6a1c141f51e
Use proposal key instead of raw proposal
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2201
diff
changeset
|
288 |
proposal_keys), None) |
1685
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
289 |
|
2097
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
290 |
# check if the current user is a mentor |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
291 |
user_entity = user_logic.logic.getForCurrentAccount() |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
292 |
|
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
293 |
fields = {'user': user_entity, |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
294 |
'scope': org_entity,} |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
295 |
mentor_entity = mentor_logic.logic.getForFields(fields, unique=True) |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
296 |
|
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
297 |
if mentor_entity: |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
298 |
mp_params = list_params.copy() # proposals mentored by current user |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
299 |
|
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
300 |
description = ugettext('List of %s sent to %s you are mentoring') % ( |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
301 |
mp_params['name_plural'], org_entity.name) |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
302 |
mp_params['list_description'] = description |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
303 |
mp_params['list_action'] = (redirects.getReviewRedirect, mp_params) |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
304 |
|
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
305 |
filter = {'org': org_entity, |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
306 |
'mentor': mentor_entity, |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
307 |
'status': 'pending'} |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
308 |
|
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
309 |
mp_list = lists.getListContent( |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
310 |
request, mp_params, filter, idx=1, need_content=True) |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
311 |
|
1668
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
312 |
new_params = list_params.copy() # new proposals |
1998
0df5351ac18a
Fixed a typo in proposal listing
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1928
diff
changeset
|
313 |
new_params['list_description'] = 'List of new %s sent to %s ' % ( |
1668
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
314 |
new_params['name_plural'], org_entity.name) |
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
315 |
new_params['list_action'] = (redirects.getReviewRedirect, new_params) |
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
316 |
|
1685
4b48cd4e4aa9
Added a rank column to the proposals list.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1683
diff
changeset
|
317 |
filter = {'org': org_entity, |
1766
75531b82a4e2
Add indention in soc.views.models.organization module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1760
diff
changeset
|
318 |
'status': 'new'} |
1668
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
319 |
|
1920
0eba9cb1b331
Change the order of student proposals lists for org admins and mentors. Now the new proposals list shows up at the top. Also don't show the list of new proposals if it's empty.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1875
diff
changeset
|
320 |
contents = [] |
1668
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
321 |
new_list = lists.getListContent( |
2097
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
322 |
request, new_params, filter, idx=2, need_content=True) |
1928
8001eee3160f
The org list proposals page now shows the amount of assigned slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1920
diff
changeset
|
323 |
|
2254
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
324 |
ap_params = list_params.copy() # accepted proposals |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
325 |
|
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
326 |
description = ugettext('List of accepted %s sent to %s ') % ( |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
327 |
ap_params['name_plural'], org_entity.name) |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
328 |
|
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
329 |
ap_params['list_description'] = description |
2259
62676277db14
Changed the accepted and rejected list to redirect to the review page in ListProposals view.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2254
diff
changeset
|
330 |
ap_params['list_action'] = (redirects.getReviewRedirect, ap_params) |
2254
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
331 |
|
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
332 |
filter = {'org': org_entity, |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
333 |
'status': 'accepted'} |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
334 |
|
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
335 |
ap_list = lists.getListContent( |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
336 |
request, ap_params, filter, idx=3, need_content=True) |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
337 |
|
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
338 |
rp_params = list_params.copy() # rejected proposals |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
339 |
|
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
340 |
description = ugettext('List of rejected %s sent to %s ') % ( |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
341 |
rp_params['name_plural'], org_entity.name) |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
342 |
|
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
343 |
rp_params['list_description'] = description |
2259
62676277db14
Changed the accepted and rejected list to redirect to the review page in ListProposals view.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2254
diff
changeset
|
344 |
rp_params['list_action'] = (redirects.getReviewRedirect, rp_params) |
2254
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
345 |
|
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
346 |
filter = {'org': org_entity, |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
347 |
'status': 'rejected'} |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
348 |
|
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
349 |
rp_list = lists.getListContent( |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
350 |
request, rp_params, filter, idx=4, need_content=True) |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
351 |
|
2036
d23379c80b48
Use ugettext and shorter variable names for inellegible list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2035
diff
changeset
|
352 |
ip_params = list_params.copy() # ineligible proposals |
d23379c80b48
Use ugettext and shorter variable names for inellegible list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2035
diff
changeset
|
353 |
|
d23379c80b48
Use ugettext and shorter variable names for inellegible list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2035
diff
changeset
|
354 |
description = ugettext('List of ineligible %s sent to %s ') % ( |
d23379c80b48
Use ugettext and shorter variable names for inellegible list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2035
diff
changeset
|
355 |
ip_params['name_plural'], org_entity.name) |
d23379c80b48
Use ugettext and shorter variable names for inellegible list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2035
diff
changeset
|
356 |
|
d23379c80b48
Use ugettext and shorter variable names for inellegible list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2035
diff
changeset
|
357 |
ip_params['list_description'] = description |
d23379c80b48
Use ugettext and shorter variable names for inellegible list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2035
diff
changeset
|
358 |
ip_params['list_action'] = (redirects.getReviewRedirect, ip_params) |
2035
5b663ac5bb14
Add listing of ineligible Student Proposals to "View all Students Proposals" view. Now mentors and org admin can see what application has been marked as ineligible or withdrawn by student.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1998
diff
changeset
|
359 |
|
5b663ac5bb14
Add listing of ineligible Student Proposals to "View all Students Proposals" view. Now mentors and org admin can see what application has been marked as ineligible or withdrawn by student.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1998
diff
changeset
|
360 |
filter = {'org': org_entity, |
5b663ac5bb14
Add listing of ineligible Student Proposals to "View all Students Proposals" view. Now mentors and org admin can see what application has been marked as ineligible or withdrawn by student.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1998
diff
changeset
|
361 |
'status': 'invalid'} |
5b663ac5bb14
Add listing of ineligible Student Proposals to "View all Students Proposals" view. Now mentors and org admin can see what application has been marked as ineligible or withdrawn by student.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1998
diff
changeset
|
362 |
|
2036
d23379c80b48
Use ugettext and shorter variable names for inellegible list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2035
diff
changeset
|
363 |
ip_list = lists.getListContent( |
2254
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
364 |
request, ip_params, filter, idx=5, need_content=True) |
2035
5b663ac5bb14
Add listing of ineligible Student Proposals to "View all Students Proposals" view. Now mentors and org admin can see what application has been marked as ineligible or withdrawn by student.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1998
diff
changeset
|
365 |
|
1668
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
366 |
# fill contents with all the needed lists |
1920
0eba9cb1b331
Change the order of student proposals lists for org admins and mentors. Now the new proposals list shows up at the top. Also don't show the list of new proposals if it's empty.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1875
diff
changeset
|
367 |
if new_list != None: |
0eba9cb1b331
Change the order of student proposals lists for org admins and mentors. Now the new proposals list shows up at the top. Also don't show the list of new proposals if it's empty.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1875
diff
changeset
|
368 |
contents.append(new_list) |
2036
d23379c80b48
Use ugettext and shorter variable names for inellegible list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2035
diff
changeset
|
369 |
|
1920
0eba9cb1b331
Change the order of student proposals lists for org admins and mentors. Now the new proposals list shows up at the top. Also don't show the list of new proposals if it's empty.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1875
diff
changeset
|
370 |
contents.append(prop_list) |
2036
d23379c80b48
Use ugettext and shorter variable names for inellegible list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2035
diff
changeset
|
371 |
|
2097
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
372 |
if mentor_entity and mp_list != None: |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
373 |
contents.append(mp_list) |
ab7a2ea3ca33
Added simple listing (no score, rank) for Student Proposals you are a mentor for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2093
diff
changeset
|
374 |
|
2254
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
375 |
if ap_list != None: |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
376 |
contents.append(ap_list) |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
377 |
|
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
378 |
if rp_list != None: |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
379 |
contents.append(rp_list) |
416da888eaa6
Added listing of accepted and rejected proposals to the organization proposal page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2250
diff
changeset
|
380 |
|
2036
d23379c80b48
Use ugettext and shorter variable names for inellegible list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2035
diff
changeset
|
381 |
if ip_list != None: |
d23379c80b48
Use ugettext and shorter variable names for inellegible list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2035
diff
changeset
|
382 |
contents.append(ip_list) |
1668
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
383 |
|
e3780ee24322
The organization proposal list has been significantly changed.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1641
diff
changeset
|
384 |
# call the _list method from base to display the list |
1928
8001eee3160f
The org list proposals page now shows the amount of assigned slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1920
diff
changeset
|
385 |
return self._list(request, list_params, contents, page_name, context) |
1489
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
386 |
|
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
387 |
@decorators.merge_params |
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
388 |
@decorators.check_access |
1325
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
389 |
def listPublic(self, request, access_type, page_name=None, |
1491
acf7e32de8ca
Style fixes in student_proposal and organization view.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1490
diff
changeset
|
390 |
params=None, filter=None, **kwargs): |
1325
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
391 |
"""See base.View.list. |
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
392 |
""" |
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
393 |
|
1600
0aa3de1b2acc
Fix access bug due to forgotten normalization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1599
diff
changeset
|
394 |
account = accounts.getCurrentAccount() |
1596
834ead6528a8
Fixed a missing .logic in organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1584
diff
changeset
|
395 |
user = user_logic.logic.getForAccount(account) if account else None |
1526
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
396 |
|
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
397 |
try: |
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
398 |
rights = self._params['rights'] |
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
399 |
rights.setCurrentUser(account, user) |
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
400 |
rights.checkIsHost() |
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
401 |
is_host = True |
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
402 |
except out_of_band.Error: |
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
403 |
is_host = False |
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
404 |
|
2177
e2c193e1f631
Do not rely on dicts.merge to change target
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2155
diff
changeset
|
405 |
params = params.copy() |
1605
df05cd289b2f
Fixed two bugs introduced in r2160.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1600
diff
changeset
|
406 |
|
1526
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1491
diff
changeset
|
407 |
if is_host: |
2177
e2c193e1f631
Do not rely on dicts.merge to change target
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2155
diff
changeset
|
408 |
params['list_action'] = (redirects.getAdminRedirect, params) |
1344
d94410538f8e
Redirect to the admin view in listPublic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1343
diff
changeset
|
409 |
else: |
2177
e2c193e1f631
Do not rely on dicts.merge to change target
Sverre Rabbelier <srabbelier@gmail.com>
parents:
2155
diff
changeset
|
410 |
params['list_action'] = (redirects.getPublicRedirect, params) |
1325
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
411 |
|
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
412 |
new_filter = {} |
1406
60b68fc36df2
List public view for organizations should be program limited.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1405
diff
changeset
|
413 |
|
60b68fc36df2
List public view for organizations should be program limited.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1405
diff
changeset
|
414 |
new_filter['scope_path'] = kwargs['scope_path'] |
1325
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
415 |
new_filter['status'] = 'active' |
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
416 |
filter = dicts.merge(filter, new_filter) |
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
417 |
|
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
418 |
content = lists.getListContent(request, params, filter) |
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
419 |
contents = [content] |
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
420 |
|
8368086dd3a7
Add a list_public view to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
421 |
return self._list(request, params, contents, page_name) |
1154
77276e2c46f7
Implement the last step in the org application process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1126
diff
changeset
|
422 |
|
2694
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
423 |
def _getMapData(self, filter=None): |
2390
723dfa4811e8
Partial fix for displaying mentors and students on Organization home page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
2334
diff
changeset
|
424 |
"""Constructs the JSON object required to generate |
723dfa4811e8
Partial fix for displaying mentors and students on Organization home page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
2334
diff
changeset
|
425 |
Google Maps on organization home page. |
2250
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
426 |
|
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
427 |
Args: |
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
428 |
filter: a dict for the properties that the entities should have |
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
429 |
|
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
430 |
Returns: |
2390
723dfa4811e8
Partial fix for displaying mentors and students on Organization home page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
2334
diff
changeset
|
431 |
A JSON object containing map data. |
2250
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
432 |
""" |
2296
ebc4931f0762
Fixed typo in docstring as to comments on r3012 (svn repo).
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2283
diff
changeset
|
433 |
|
ebc4931f0762
Fixed typo in docstring as to comments on r3012 (svn repo).
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2283
diff
changeset
|
434 |
from soc.logic.models.student_project import logic as student_project_logic |
2694
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
435 |
from soc.views.models import student_project as student_project_view |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
436 |
|
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
437 |
sp_params = student_project_view.view.getParams().copy() |
2250
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
438 |
|
2390
723dfa4811e8
Partial fix for displaying mentors and students on Organization home page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
2334
diff
changeset
|
439 |
people = {} |
2694
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
440 |
projects = {} |
2250
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
441 |
|
2694
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
442 |
# get all the student_project entities for the given filter |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
443 |
student_project_entities = student_project_logic.getForFields( |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
444 |
filter=filter) |
2250
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
445 |
|
2694
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
446 |
# Construct a dictionary of mentors and students. For each mentor construct |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
447 |
# a list of 3-tuples containing student name, project title and url. |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
448 |
# And for each student a list of 3 tuples containing mentor name, project |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
449 |
# title and url. Only students and mentors who have agreed to publish their |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
450 |
# locations will be in the dictionary. |
2250
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
451 |
for entity in student_project_entities: |
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
452 |
|
2694
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
453 |
project_key_name = entity.key().id_or_name() |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
454 |
project_redirect = redirects.getPublicRedirect(entity, sp_params) |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
455 |
|
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
456 |
student_entity = entity.student |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
457 |
student_key_name = student_entity.key().id_or_name() |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
458 |
|
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
459 |
mentor_entity = entity.mentor |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
460 |
mentor_key_name = mentor_entity.key().id_or_name() |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
461 |
|
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
462 |
# store the project data in the projects dictionary |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
463 |
projects[project_key_name] = {'title': entity.title, |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
464 |
'redirect': project_redirect, |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
465 |
'student_key': student_key_name, |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
466 |
'student_name': student_entity.name(), |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
467 |
'mentor_key': mentor_key_name, |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
468 |
'mentor_name': mentor_entity.name()} |
2250
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
469 |
|
2694
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
470 |
if mentor_entity.publish_location: |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
471 |
if mentor_key_name not in people: |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
472 |
# we have not stored the information of this mentor yet |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
473 |
people[mentor_key_name] = { |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
474 |
'type': 'mentor', |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
475 |
'name': mentor_entity.name(), |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
476 |
'lat': mentor_entity.latitude, |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
477 |
'long': mentor_entity.longitude, |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
478 |
'projects': [] |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
479 |
} |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
480 |
|
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
481 |
# add this project to the mentor's list |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
482 |
people[mentor_key_name]['projects'].append(project_key_name) |
2250
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
483 |
|
2694
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
484 |
if student_entity.publish_location: |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
485 |
if student_key_name not in people: |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
486 |
# new student, store the name and location |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
487 |
people[student_key_name] = { |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
488 |
'type': 'student', |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
489 |
'name': student_entity.name(), |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
490 |
'lat': student_entity.latitude, |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
491 |
'long': student_entity.longitude, |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
492 |
'projects': [], |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
493 |
} |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
494 |
|
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
495 |
# append the current project to the known student's list of projects |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
496 |
people[student_key_name]['projects'].append(project_key_name) |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
497 |
|
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
498 |
# combine the people and projects data into one JSON object |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
499 |
data = {} |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
500 |
# TODO: to enable map data uncomment the piece of code below |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
501 |
#data = {'people': people, |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
502 |
# 'projects': projects} |
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
503 |
|
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
504 |
return simplejson.dumps(data) |
2250
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
505 |
|
2121
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
506 |
def _public(self, request, entity, context): |
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
507 |
"""See base.View._public(). |
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
508 |
""" |
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
509 |
|
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
510 |
from soc.views.models import student_project as student_project_view |
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
511 |
|
2207
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
512 |
program_entity = entity.scope |
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
513 |
|
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
514 |
if timeline_helper.isAfterEvent(program_entity.timeline, |
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
515 |
'accepted_students_announced_deadline'): |
2283
f92942dfc28f
Fix too long line in soc.view.models.organization module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
2259
diff
changeset
|
516 |
# accepted projects |
2694
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
517 |
ap_params = student_project_view.view.getParams().copy() |
2121
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
518 |
|
2207
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
519 |
# define the list redirect action to show the notification |
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
520 |
ap_params['list_action'] = (redirects.getPublicRedirect, ap_params) |
2694
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
521 |
ap_params['list_description'] = self.DEF_ACCEPTED_PROJECTS_MSG_FMT %( |
2207
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
522 |
entity.name) |
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
523 |
ap_params['list_heading'] = 'soc/student_project/list/heading.html' |
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
524 |
ap_params['list_row'] = 'soc/student_project/list/row.html' |
2121
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
525 |
|
2207
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
526 |
# only show projects that have not failed |
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
527 |
filter = {'scope': entity, |
2573
f09f317769c4
Changed the StudentProject model to handle a dynamic amount of GradeRecords.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2418
diff
changeset
|
528 |
'status': ['accepted', 'completed']} |
2121
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
529 |
|
2207
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
530 |
ap_list = lists.getListContent(request, ap_params, filter, idx=0, |
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
531 |
need_content=True) |
2121
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
532 |
|
2207
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
533 |
contents = [] |
2121
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
534 |
|
2207
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
535 |
if ap_list: |
2418
32cb30846cfd
Fixes an issue where the organization home page would throw a 505 when no projects where accepted.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2390
diff
changeset
|
536 |
# this is a temporary fix for sorting Student Projects |
32cb30846cfd
Fixes an issue where the organization home page would throw a 505 when no projects where accepted.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2390
diff
changeset
|
537 |
# by Student name until we have a view that default |
32cb30846cfd
Fixes an issue where the organization home page would throw a 505 when no projects where accepted.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2390
diff
changeset
|
538 |
# sorts it self by name (right now we can't do such query) |
32cb30846cfd
Fixes an issue where the organization home page would throw a 505 when no projects where accepted.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2390
diff
changeset
|
539 |
ap_list['data'].sort(key=lambda sp: sp.student.name().lower()) |
32cb30846cfd
Fixes an issue where the organization home page would throw a 505 when no projects where accepted.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2390
diff
changeset
|
540 |
|
2207
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
541 |
contents.append(ap_list) |
2121
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
542 |
|
2207
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
543 |
# construct the list and put it into the context |
f283f7b99427
The listing of accepted projects on the Organization's homepage is now timeline dependent.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2202
diff
changeset
|
544 |
context['list'] = soc.logic.lists.Lists(contents) |
2121
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
545 |
|
2250
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
546 |
# obtain data to construct the organization map as json object |
2694
b8f083157e33
Redone the gathering of data for the student<->mentor map.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2573
diff
changeset
|
547 |
context['org_map_data'] = self._getMapData(filter) |
2250
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
548 |
|
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
549 |
return super(View, self)._public(request=request, entity=entity, |
a172051d9b99
Added the gathering of data required to display a map on the org home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2220
diff
changeset
|
550 |
context=context) |
2121
4f6344dfab28
Added list of projects to the organization home page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2103
diff
changeset
|
551 |
|
1264
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
552 |
def _getExtraMenuItems(self, role_description, params=None): |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
553 |
"""Used to create the specific Organization menu entries. |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
554 |
|
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
555 |
For args see group.View._getExtraMenuItems(). |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
556 |
""" |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
557 |
submenus = [] |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
558 |
|
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
559 |
group_entity = role_description['group'] |
2146
57c74ce47fa3
Added Manage Student Projects item to the organization menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2129
diff
changeset
|
560 |
program_entity = group_entity.scope |
1264
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
561 |
roles = role_description['roles'] |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
562 |
|
1489
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
563 |
if roles.get('org_admin') or roles.get('mentor'): |
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
564 |
# add a link to view all the student proposals |
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
565 |
submenu = (redirects.getListProposalsRedirect(group_entity, params), |
1490
cb7a272bfd04
Textual changes in organization and program view.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1489
diff
changeset
|
566 |
"View all Student Proposals", 'any_access') |
1489
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
567 |
submenus.append(submenu) |
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
568 |
|
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
569 |
|
1264
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
570 |
if roles.get('org_admin'): |
2146
57c74ce47fa3
Added Manage Student Projects item to the organization menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2129
diff
changeset
|
571 |
# add a link to manage student projects after they have been announced |
57c74ce47fa3
Added Manage Student Projects item to the organization menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2129
diff
changeset
|
572 |
if timeline_helper.isAfterEvent(program_entity.timeline, |
57c74ce47fa3
Added Manage Student Projects item to the organization menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2129
diff
changeset
|
573 |
'accepted_students_announced_deadline'): |
57c74ce47fa3
Added Manage Student Projects item to the organization menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2129
diff
changeset
|
574 |
submenu = (redirects.getManageOverviewRedirect(group_entity, |
57c74ce47fa3
Added Manage Student Projects item to the organization menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2129
diff
changeset
|
575 |
{'url_name': 'student_project'}), |
57c74ce47fa3
Added Manage Student Projects item to the organization menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2129
diff
changeset
|
576 |
"Manage Student Projects", 'any_access') |
57c74ce47fa3
Added Manage Student Projects item to the organization menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2129
diff
changeset
|
577 |
submenus.append(submenu) |
57c74ce47fa3
Added Manage Student Projects item to the organization menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2129
diff
changeset
|
578 |
|
1264
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
579 |
# add a link to the management page |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
580 |
submenu = (redirects.getListRolesRedirect(group_entity, params), |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
581 |
"Manage Admins and Mentors", 'any_access') |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
582 |
submenus.append(submenu) |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
583 |
|
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
584 |
# add a link to invite an org admin |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
585 |
submenu = (redirects.getInviteRedirectForRole(group_entity, 'org_admin'), |
1463
d25793debbfb
Remove superfluous 'Org' in links
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1436
diff
changeset
|
586 |
"Invite an Admin", 'any_access') |
1264
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
587 |
submenus.append(submenu) |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
588 |
|
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
589 |
# add a link to invite a member |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
590 |
submenu = (redirects.getInviteRedirectForRole(group_entity, 'mentor'), |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
591 |
"Invite a Mentor", 'any_access') |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
592 |
submenus.append(submenu) |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
593 |
|
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
594 |
# add a link to the request page |
1599
b56976cac36b
Add myself to authors on this file, and allow my whitespace cleanup hook to cleanup whitespace.
Augie Fackler <durin42@gmail.com>
parents:
1598
diff
changeset
|
595 |
submenu = (redirects.getListRequestsRedirect(group_entity, params), |
1264
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
596 |
"List Requests and Invites", 'any_access') |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
597 |
submenus.append(submenu) |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
598 |
|
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
599 |
# add a link to the edit page |
1599
b56976cac36b
Add myself to authors on this file, and allow my whitespace cleanup hook to cleanup whitespace.
Augie Fackler <durin42@gmail.com>
parents:
1598
diff
changeset
|
600 |
submenu = (redirects.getEditRedirect(group_entity, params), |
1264
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
601 |
"Edit Organization Profile", 'any_access') |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
602 |
submenus.append(submenu) |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
603 |
|
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
604 |
if roles.get('org_admin') or roles.get('mentor'): |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
605 |
submenu = (redirects.getCreateDocumentRedirect(group_entity, 'org'), |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
606 |
"Create a New Document", 'any_access') |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
607 |
submenus.append(submenu) |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
608 |
|
1317
fad74cf4e5da
Add a 'list documents' link everywhere
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
609 |
submenu = (redirects.getListDocumentsRedirect(group_entity, 'org'), |
fad74cf4e5da
Add a 'list documents' link everywhere
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
610 |
"List Documents", 'any_access') |
fad74cf4e5da
Add a 'list documents' link everywhere
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
611 |
submenus.append(submenu) |
fad74cf4e5da
Add a 'list documents' link everywhere
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1308
diff
changeset
|
612 |
|
1489
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
613 |
|
1264
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
614 |
if roles.get('org_admin'): |
1283
438dceed3132
Add ToS agreement to org_admin application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1266
diff
changeset
|
615 |
# add a link to the resign page |
1599
b56976cac36b
Add myself to authors on this file, and allow my whitespace cleanup hook to cleanup whitespace.
Augie Fackler <durin42@gmail.com>
parents:
1598
diff
changeset
|
616 |
submenu = (redirects.getManageRedirect(roles['org_admin'], |
b56976cac36b
Add myself to authors on this file, and allow my whitespace cleanup hook to cleanup whitespace.
Augie Fackler <durin42@gmail.com>
parents:
1598
diff
changeset
|
617 |
{'url_name': 'org_admin'}), |
1463
d25793debbfb
Remove superfluous 'Org' in links
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1436
diff
changeset
|
618 |
"Resign as Admin", 'any_access') |
1264
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
619 |
submenus.append(submenu) |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
620 |
|
1283
438dceed3132
Add ToS agreement to org_admin application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1266
diff
changeset
|
621 |
# add a link to the edit page |
438dceed3132
Add ToS agreement to org_admin application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1266
diff
changeset
|
622 |
submenu = (redirects.getEditRedirect(roles['org_admin'], |
438dceed3132
Add ToS agreement to org_admin application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1266
diff
changeset
|
623 |
{'url_name': 'org_admin'}), |
1463
d25793debbfb
Remove superfluous 'Org' in links
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1436
diff
changeset
|
624 |
"Edit My Admin Profile", 'any_access') |
1283
438dceed3132
Add ToS agreement to org_admin application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1266
diff
changeset
|
625 |
submenus.append(submenu) |
438dceed3132
Add ToS agreement to org_admin application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1266
diff
changeset
|
626 |
|
1489
e12e08c8b258
Added view for organizations to list all proposals.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1463
diff
changeset
|
627 |
|
1264
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
628 |
if roles.get('mentor'): |
1284
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1283
diff
changeset
|
629 |
# add a link to the resign page |
1599
b56976cac36b
Add myself to authors on this file, and allow my whitespace cleanup hook to cleanup whitespace.
Augie Fackler <durin42@gmail.com>
parents:
1598
diff
changeset
|
630 |
submenu = (redirects.getManageRedirect(roles['mentor'], |
b56976cac36b
Add myself to authors on this file, and allow my whitespace cleanup hook to cleanup whitespace.
Augie Fackler <durin42@gmail.com>
parents:
1598
diff
changeset
|
631 |
{'url_name' : 'mentor'}), |
1264
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
632 |
"Resign as Mentor", 'any_access') |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
633 |
submenus.append(submenu) |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
634 |
|
1284
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1283
diff
changeset
|
635 |
# add a link to the edit page |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1283
diff
changeset
|
636 |
submenu = (redirects.getEditRedirect(roles['mentor'], |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1283
diff
changeset
|
637 |
{'url_name': 'mentor'}), |
1463
d25793debbfb
Remove superfluous 'Org' in links
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1436
diff
changeset
|
638 |
"Edit My Mentor Profile", 'any_access') |
1284
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1283
diff
changeset
|
639 |
submenus.append(submenu) |
92f7a24d8f42
Add ToS agreement to mentor application related forms.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1283
diff
changeset
|
640 |
|
1264
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1221
diff
changeset
|
641 |
return submenus |
1126
4fc86db70a76
Added organization view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1079
diff
changeset
|
642 |
|
682 | 643 |
|
644 |
view = View() |
|
645 |
||
1584
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1567
diff
changeset
|
646 |
admin = decorators.view(view.admin) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1567
diff
changeset
|
647 |
applicant = decorators.view(view.applicant) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1567
diff
changeset
|
648 |
apply_mentor = decorators.view(view.applyMentor) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1567
diff
changeset
|
649 |
create = decorators.view(view.create) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1567
diff
changeset
|
650 |
delete = decorators.view(view.delete) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1567
diff
changeset
|
651 |
edit = decorators.view(view.edit) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1567
diff
changeset
|
652 |
home = decorators.view(view.home) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1567
diff
changeset
|
653 |
list = decorators.view(view.list) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1567
diff
changeset
|
654 |
list_proposals = decorators.view(view.listProposals) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1567
diff
changeset
|
655 |
list_public = decorators.view(view.listPublic) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1567
diff
changeset
|
656 |
list_requests = decorators.view(view.listRequests) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1567
diff
changeset
|
657 |
list_roles = decorators.view(view.listRoles) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1567
diff
changeset
|
658 |
public = decorators.view(view.public) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1567
diff
changeset
|
659 |
export = decorators.view(view.export) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1567
diff
changeset
|
660 |
pick = decorators.view(view.pick) |