author | Sverre Rabbelier <sverre@rabbelier.nl> |
Sat, 01 Aug 2009 16:22:10 -0700 | |
changeset 2707 | ffabb3576744 |
parent 2177 | e2c193e1f631 |
permissions | -rw-r--r-- |
782
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
2 |
# |
1307
091a21cf3627
Update the copyright notice for 2009.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1303
diff
changeset
|
3 |
# Copyright 2009 the Melange authors. |
782
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
4 |
# |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
8 |
# |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
10 |
# |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
16 |
|
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
17 |
"""Views for Clubs. |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
18 |
""" |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
19 |
|
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
20 |
__authors__ = [ |
800
738f6335b0e2
Added a create method that uses an existing application
Sverre Rabbelier <srabbelier@gmail.com>
parents:
799
diff
changeset
|
21 |
'"Sverre Rabbelier" <sverre@rabbelier.nl>', |
782
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
22 |
'"Lennard de Rijk" <ljvderijk@gmail.com>', |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
23 |
] |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
24 |
|
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
25 |
|
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
26 |
from django import forms |
1638
ee654f3d1bba
Remove unused imports and fix too long lines and some style fixes in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1584
diff
changeset
|
27 |
from django.utils.translation import ugettext |
782
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
28 |
|
1083
b8018d7a9f23
Moved clean_club_app_link_id to cleaning.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1069
diff
changeset
|
29 |
from soc.logic import cleaning |
782
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
30 |
from soc.logic import dicts |
882
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
878
diff
changeset
|
31 |
from soc.logic.models import club_app as club_app_logic |
1163
d8c50be19232
Cleaned up access.py
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1153
diff
changeset
|
32 |
from soc.logic.models import club as club_logic |
d8c50be19232
Cleaned up access.py
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1153
diff
changeset
|
33 |
from soc.logic.models import club_admin as club_admin_logic |
802
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
800
diff
changeset
|
34 |
from soc.views.helper import access |
878
fdfab50cc9df
Fix trailing whitespace and apply decorators
Sverre Rabbelier <srabbelier@gmail.com>
parents:
877
diff
changeset
|
35 |
from soc.views.helper import decorators |
869
cd17698846ce
Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
36 |
from soc.views.helper import dynaform |
1003
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
37 |
from soc.views.helper import redirects |
782
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
38 |
from soc.views.helper import widgets |
989
f52654ea6350
Moved listRequests from club to group view.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
983
diff
changeset
|
39 |
from soc.views.models import group |
782
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
40 |
|
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
41 |
import soc.logic.models.club |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
42 |
|
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
43 |
|
989
f52654ea6350
Moved listRequests from club to group view.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
983
diff
changeset
|
44 |
class View(group.View): |
782
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
45 |
"""View methods for the Club model. |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
46 |
""" |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
47 |
|
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
48 |
def __init__(self, params=None): |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
49 |
"""Defines the fields and methods required for the base View class |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
50 |
to provide the user with list, public, create, edit and delete views. |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
51 |
|
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
52 |
Params: |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
53 |
params: a dict with params for this View |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
54 |
""" |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
55 |
|
1007
3b66772d21a5
Major refactor of the access module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1006
diff
changeset
|
56 |
rights = access.Checker(params) |
3b66772d21a5
Major refactor of the access module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1006
diff
changeset
|
57 |
rights['create'] = ['checkIsDeveloper'] |
1526
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
58 |
rights['edit'] = [('checkHasActiveRoleForLinkId', club_admin_logic.logic), |
5c31184594a5
Convert everything to use the new access methods
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1430
diff
changeset
|
59 |
('checkGroupIsActiveForLinkId', club_logic.logic)] |
1007
3b66772d21a5
Major refactor of the access module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1006
diff
changeset
|
60 |
rights['delete'] = ['checkIsDeveloper'] |
3b66772d21a5
Major refactor of the access module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1006
diff
changeset
|
61 |
rights['home'] = ['allow'] |
3b66772d21a5
Major refactor of the access module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1006
diff
changeset
|
62 |
rights['list'] = ['checkIsDeveloper'] |
1163
d8c50be19232
Cleaned up access.py
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1153
diff
changeset
|
63 |
rights['apply_member'] = ['checkIsUser', |
1638
ee654f3d1bba
Remove unused imports and fix too long lines and some style fixes in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1584
diff
changeset
|
64 |
('checkGroupIsActiveForScopeAndLinkId', |
ee654f3d1bba
Remove unused imports and fix too long lines and some style fixes in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1584
diff
changeset
|
65 |
club_logic.logic)] |
ee654f3d1bba
Remove unused imports and fix too long lines and some style fixes in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1584
diff
changeset
|
66 |
rights['list_requests'] = [('checkHasActiveRoleForLinkId', |
ee654f3d1bba
Remove unused imports and fix too long lines and some style fixes in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1584
diff
changeset
|
67 |
club_admin_logic.logic)] |
ee654f3d1bba
Remove unused imports and fix too long lines and some style fixes in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1584
diff
changeset
|
68 |
rights['list_roles'] = [('checkHasActiveRoleForLinkId', |
ee654f3d1bba
Remove unused imports and fix too long lines and some style fixes in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1584
diff
changeset
|
69 |
club_admin_logic.logic)] |
1163
d8c50be19232
Cleaned up access.py
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1153
diff
changeset
|
70 |
rights['applicant'] = [('checkIsApplicationAccepted', |
d8c50be19232
Cleaned up access.py
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1153
diff
changeset
|
71 |
club_app_logic.logic)] |
802
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
800
diff
changeset
|
72 |
|
782
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
73 |
new_params = {} |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
74 |
new_params['logic'] = soc.logic.models.club.logic |
802
95c534d02e39
Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents:
800
diff
changeset
|
75 |
new_params['rights'] = rights |
869
cd17698846ce
Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
76 |
new_params['name'] = "Club" |
1006
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
77 |
new_params['url_name'] = "club" |
1303
08433090cff8
Add prefix filtering and refactored program field generation
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1293
diff
changeset
|
78 |
new_params['document_prefix'] = "club" |
1025
1f83f05f522b
Add grouping to the existing views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1012
diff
changeset
|
79 |
new_params['sidebar_grouping'] = 'Clubs' |
877
b2575da44c36
Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
869
diff
changeset
|
80 |
|
1330
fa13d8b45594
Remove private data from club and org public templates
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
81 |
new_params['public_template'] = 'soc/group/public.html' |
fa13d8b45594
Remove private data from club and org public templates
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1317
diff
changeset
|
82 |
|
869
cd17698846ce
Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
83 |
patterns = [] |
983
1bbf226ade8e
Added request listing for Club Admins.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
963
diff
changeset
|
84 |
|
1153
4804f7f5a7c0
Refactored applicant from club view to group view.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1144
diff
changeset
|
85 |
patterns += [(r'^%(url_name)s/(?P<access_type>apply_member)$', |
1006
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
86 |
'soc.views.models.%(module_name)s.apply_member', |
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
87 |
"List of all %(name_plural)s you can apply to"),] |
877
b2575da44c36
Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
869
diff
changeset
|
88 |
|
869
cd17698846ce
Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
89 |
new_params['extra_django_patterns'] = patterns |
799
30a912906a57
Construct names automatically from base name.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
790
diff
changeset
|
90 |
|
1153
4804f7f5a7c0
Refactored applicant from club view to group view.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1144
diff
changeset
|
91 |
new_params['application_logic'] = club_app_logic |
4804f7f5a7c0
Refactored applicant from club view to group view.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1144
diff
changeset
|
92 |
new_params['group_applicant_url'] = True |
4804f7f5a7c0
Refactored applicant from club view to group view.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1144
diff
changeset
|
93 |
|
1006
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
94 |
new_params['sidebar_additional'] = [ |
1638
ee654f3d1bba
Remove unused imports and fix too long lines and some style fixes in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1584
diff
changeset
|
95 |
('/' + new_params['url_name'] + '/apply_member', |
ee654f3d1bba
Remove unused imports and fix too long lines and some style fixes in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1584
diff
changeset
|
96 |
'Join a Club', 'apply_member'),] |
1006
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
97 |
|
1875
69d60793092a
Specify the type of Link ID used
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1638
diff
changeset
|
98 |
new_params['create_dynafields'] = [ |
69d60793092a
Specify the type of Link ID used
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1638
diff
changeset
|
99 |
{'name': 'link_id', |
69d60793092a
Specify the type of Link ID used
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1638
diff
changeset
|
100 |
'base': forms.fields.CharField, |
69d60793092a
Specify the type of Link ID used
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1638
diff
changeset
|
101 |
'label': 'Club Link ID', |
69d60793092a
Specify the type of Link ID used
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1638
diff
changeset
|
102 |
}, |
69d60793092a
Specify the type of Link ID used
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1638
diff
changeset
|
103 |
] |
69d60793092a
Specify the type of Link ID used
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1638
diff
changeset
|
104 |
|
1430
ff8cc6b15e6a
Rename dynafields to dynaproperties
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1343
diff
changeset
|
105 |
new_params['create_extra_dynaproperties'] = { |
1205
2e88261aba72
Added validate_new_group to cleaning and removed clean_new_club_link_id.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1203
diff
changeset
|
106 |
'clean' : cleaning.validate_new_group('link_id', 'scope_path', |
2e88261aba72
Added validate_new_group to cleaning and removed clean_new_club_link_id.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1203
diff
changeset
|
107 |
club_logic, club_app_logic)} |
2e88261aba72
Added validate_new_group to cleaning and removed clean_new_club_link_id.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1203
diff
changeset
|
108 |
|
2e88261aba72
Added validate_new_group to cleaning and removed clean_new_club_link_id.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1203
diff
changeset
|
109 |
# get rid of the clean method |
1430
ff8cc6b15e6a
Rename dynafields to dynaproperties
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1343
diff
changeset
|
110 |
new_params['edit_extra_dynaproperties'] = { |
1205
2e88261aba72
Added validate_new_group to cleaning and removed clean_new_club_link_id.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1203
diff
changeset
|
111 |
'clean' : (lambda x: x.cleaned_data)} |
782
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
112 |
|
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
113 |
params = dicts.merge(params, new_params) |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
114 |
|
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
115 |
super(View, self).__init__(params=params) |
877
b2575da44c36
Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
869
diff
changeset
|
116 |
|
869
cd17698846ce
Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
117 |
# create and store the special form for applicants |
cd17698846ce
Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
118 |
updated_fields = { |
cd17698846ce
Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
119 |
'link_id': forms.CharField(widget=widgets.ReadOnlyInput(), |
1083
b8018d7a9f23
Moved clean_club_app_link_id to cleaning.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1069
diff
changeset
|
120 |
required=False), |
b8018d7a9f23
Moved clean_club_app_link_id to cleaning.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1069
diff
changeset
|
121 |
'clean_link_id': cleaning.clean_link_id('link_id')} |
877
b2575da44c36
Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
869
diff
changeset
|
122 |
|
869
cd17698846ce
Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
123 |
applicant_create_form = dynaform.extendDynaForm( |
cd17698846ce
Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
858
diff
changeset
|
124 |
dynaform = self._params['create_form'], |
1430
ff8cc6b15e6a
Rename dynafields to dynaproperties
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1343
diff
changeset
|
125 |
dynaproperties = updated_fields) |
877
b2575da44c36
Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
869
diff
changeset
|
126 |
|
2177
e2c193e1f631
Do not rely on dicts.merge to change target
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1875
diff
changeset
|
127 |
self._params['applicant_create_form'] = applicant_create_form |
782
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
128 |
|
878
fdfab50cc9df
Fix trailing whitespace and apply decorators
Sverre Rabbelier <srabbelier@gmail.com>
parents:
877
diff
changeset
|
129 |
@decorators.merge_params |
fdfab50cc9df
Fix trailing whitespace and apply decorators
Sverre Rabbelier <srabbelier@gmail.com>
parents:
877
diff
changeset
|
130 |
@decorators.check_access |
1006
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
131 |
def applyMember(self, request, access_type, |
1030
a0081c626acb
Style fixes in soc.views.models modules.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1025
diff
changeset
|
132 |
page_name=None, params=None, **kwargs): |
1638
ee654f3d1bba
Remove unused imports and fix too long lines and some style fixes in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1584
diff
changeset
|
133 |
"""Shows a list of all clubs and you can choose one to |
ee654f3d1bba
Remove unused imports and fix too long lines and some style fixes in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1584
diff
changeset
|
134 |
apply to become a member. |
1006
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
135 |
|
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
136 |
Args: |
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
137 |
request: the standard Django HTTP request object |
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
138 |
access_type : the name of the access type which should be checked |
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
139 |
page_name: the page name displayed in templates as page and header title |
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
140 |
params: a dict with params for this View |
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
141 |
kwargs: the Key Fields for the specified entity |
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
142 |
""" |
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
143 |
|
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
144 |
list_params = params.copy() |
1638
ee654f3d1bba
Remove unused imports and fix too long lines and some style fixes in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1584
diff
changeset
|
145 |
list_params['list_action'] = (redirects.getRequestRedirectForRole, |
ee654f3d1bba
Remove unused imports and fix too long lines and some style fixes in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1584
diff
changeset
|
146 |
'club_member') |
ee654f3d1bba
Remove unused imports and fix too long lines and some style fixes in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1584
diff
changeset
|
147 |
list_params['list_description'] = ugettext('Choose a club to ' |
ee654f3d1bba
Remove unused imports and fix too long lines and some style fixes in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1584
diff
changeset
|
148 |
'apply to become a Club Member.') |
1006
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
149 |
|
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
150 |
return self.list(request, access_type, |
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
151 |
page_name, params=list_params, filter=None) |
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
152 |
|
6abf12b9e646
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1005
diff
changeset
|
153 |
|
1003
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
154 |
def _getExtraMenuItems(self, role_description, params=None): |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
155 |
"""Used to create the specific club menu entries. |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
156 |
|
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
157 |
For args see group.View._getExtraMenuItems(). |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
158 |
""" |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
159 |
|
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
160 |
submenus = [] |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
161 |
|
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
162 |
group_entity = role_description['group'] |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
163 |
roles = role_description['roles'] |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
164 |
|
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
165 |
if roles.get('club_admin'): |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
166 |
# add a link to the management page |
1097
1f7015b33a0c
Add a 'Create new document' link for clubs, sponsors and programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1083
diff
changeset
|
167 |
submenu = (redirects.getListRolesRedirect(group_entity, params), |
1003
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
168 |
"Manage Admins and Members", 'any_access') |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
169 |
submenus.append(submenu) |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
170 |
|
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
171 |
# add a link to invite an admin |
1097
1f7015b33a0c
Add a 'Create new document' link for clubs, sponsors and programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1083
diff
changeset
|
172 |
submenu = (redirects.getInviteRedirectForRole(group_entity, 'club_admin'), |
1003
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
173 |
"Invite an Admin", 'any_access') |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
174 |
submenus.append(submenu) |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
175 |
|
1004
bfc8e9582c47
Fixed typo in club sidebar entry.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1003
diff
changeset
|
176 |
# add a link to invite a member |
1638
ee654f3d1bba
Remove unused imports and fix too long lines and some style fixes in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1584
diff
changeset
|
177 |
submenu = (redirects.getInviteRedirectForRole(group_entity, |
ee654f3d1bba
Remove unused imports and fix too long lines and some style fixes in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1584
diff
changeset
|
178 |
'club_member'), "Invite a Member", 'any_access') |
1003
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
179 |
submenus.append(submenu) |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
180 |
|
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
181 |
# add a link to the request page |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
182 |
submenu = (redirects.getListRequestsRedirect(group_entity, params), |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
183 |
"List Requests and Invites", 'any_access') |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
184 |
submenus.append(submenu) |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
185 |
|
1005
46b3e946a3e1
Changed method name in access.py to fix overwriting another method.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1004
diff
changeset
|
186 |
# add a link to the edit page |
46b3e946a3e1
Changed method name in access.py to fix overwriting another method.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1004
diff
changeset
|
187 |
submenu = (redirects.getEditRedirect(group_entity, params), |
46b3e946a3e1
Changed method name in access.py to fix overwriting another method.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1004
diff
changeset
|
188 |
"Edit Club Profile", 'any_access') |
46b3e946a3e1
Changed method name in access.py to fix overwriting another method.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1004
diff
changeset
|
189 |
submenus.append(submenu) |
46b3e946a3e1
Changed method name in access.py to fix overwriting another method.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1004
diff
changeset
|
190 |
|
1264
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1248
diff
changeset
|
191 |
if roles.get('club_member') or roles.get('club_admin'): |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1248
diff
changeset
|
192 |
submenu = (redirects.getCreateDocumentRedirect(group_entity, 'club'), |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1248
diff
changeset
|
193 |
"Create a New Document", 'any_access') |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1248
diff
changeset
|
194 |
submenus.append(submenu) |
4d46b09f3751
Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1248
diff
changeset
|
195 |
|
1317
fad74cf4e5da
Add a 'list documents' link everywhere
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1307
diff
changeset
|
196 |
submenu = (redirects.getListDocumentsRedirect(group_entity, 'club'), |
fad74cf4e5da
Add a 'list documents' link everywhere
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1307
diff
changeset
|
197 |
"List Documents", 'any_access') |
fad74cf4e5da
Add a 'list documents' link everywhere
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1307
diff
changeset
|
198 |
submenus.append(submenu) |
fad74cf4e5da
Add a 'list documents' link everywhere
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1307
diff
changeset
|
199 |
|
1293
d5ea34c4fc43
Only a club admin should see resign as club admin in the sidebar.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1264
diff
changeset
|
200 |
if roles.get('club_admin'): |
1069
e8bcc5a26532
Added resign as club admin and club member links to the club entity menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1063
diff
changeset
|
201 |
# add a link to resign as club admin |
e8bcc5a26532
Added resign as club admin and club member links to the club entity menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1063
diff
changeset
|
202 |
submenu = (redirects.getManageRedirect(roles['club_admin'], |
e8bcc5a26532
Added resign as club admin and club member links to the club entity menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1063
diff
changeset
|
203 |
{'url_name': 'club_admin'}), |
e8bcc5a26532
Added resign as club admin and club member links to the club entity menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1063
diff
changeset
|
204 |
"Resign as Club Admin", 'any_access') |
e8bcc5a26532
Added resign as club admin and club member links to the club entity menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1063
diff
changeset
|
205 |
submenus.append(submenu) |
e8bcc5a26532
Added resign as club admin and club member links to the club entity menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1063
diff
changeset
|
206 |
|
e8bcc5a26532
Added resign as club admin and club member links to the club entity menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1063
diff
changeset
|
207 |
if roles.get('club_member'): |
e8bcc5a26532
Added resign as club admin and club member links to the club entity menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1063
diff
changeset
|
208 |
# add a link to resign as club member |
e8bcc5a26532
Added resign as club admin and club member links to the club entity menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1063
diff
changeset
|
209 |
submenu = (redirects.getManageRedirect(roles['club_member'], |
e8bcc5a26532
Added resign as club admin and club member links to the club entity menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1063
diff
changeset
|
210 |
{'url_name' : 'club_member'}), |
e8bcc5a26532
Added resign as club admin and club member links to the club entity menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1063
diff
changeset
|
211 |
"Resign as Club Member", 'any_access') |
e8bcc5a26532
Added resign as club admin and club member links to the club entity menu.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1063
diff
changeset
|
212 |
submenus.append(submenu) |
1003
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
213 |
|
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
214 |
return submenus |
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
215 |
|
b13da1ddcd50
Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
998
diff
changeset
|
216 |
|
782
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
217 |
view = View() |
27924b0f13cd
Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff
changeset
|
218 |
|
1584
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1526
diff
changeset
|
219 |
admin = decorators.view(view.admin) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1526
diff
changeset
|
220 |
applicant = decorators.view(view.applicant) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1526
diff
changeset
|
221 |
apply_member = decorators.view(view.applyMember) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1526
diff
changeset
|
222 |
create = decorators.view(view.create) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1526
diff
changeset
|
223 |
delete = decorators.view(view.delete) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1526
diff
changeset
|
224 |
edit = decorators.view(view.edit) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1526
diff
changeset
|
225 |
home = decorators.view(view.home) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1526
diff
changeset
|
226 |
list = decorators.view(view.list) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1526
diff
changeset
|
227 |
list_requests = decorators.view(view.listRequests) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1526
diff
changeset
|
228 |
list_roles = decorators.view(view.listRoles) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1526
diff
changeset
|
229 |
public = decorators.view(view.public) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1526
diff
changeset
|
230 |
export = decorators.view(view.export) |
d8ba8c917f37
Make use of decorators.view for all views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1526
diff
changeset
|
231 |
pick = decorators.view(view.pick) |