author | Lennard de Rijk <ljvderijk@gmail.com> |
Wed, 21 Jan 2009 20:25:07 +0000 | |
changeset 886 | f5847f24c56e |
parent 885 | f46b689e19eb |
child 890 | b3bf833c4580 |
permissions | -rw-r--r-- |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
2 |
# |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
3 |
# Copyright 2008 the Melange authors. |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
4 |
# |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
8 |
# |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
10 |
# |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
16 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
17 |
"""Views for Club App profiles. |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
18 |
""" |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
19 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
20 |
__authors__ = [ |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
21 |
'"Sverre Rabbelier" <sverre@rabbelier.nl>', |
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
22 |
'"Lennard de Rijk" <ljvderijk@gmail.com>', |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
23 |
] |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
24 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
25 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
26 |
from django import forms |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
27 |
from django.utils.translation import ugettext_lazy |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
28 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
29 |
from soc.logic import accounts |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
30 |
from soc.logic import cleaning |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
31 |
from soc.logic import dicts |
821
5afe16b2e86b
Send a notifcation if a club application is accepted
Sverre Rabbelier <srabbelier@gmail.com>
parents:
818
diff
changeset
|
32 |
from soc.logic.helper import notifications |
882
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
876
diff
changeset
|
33 |
from soc.logic.models import club_app as club_app_logic |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
34 |
from soc.logic.models import user as user_logic |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
35 |
from soc.views import helper |
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
36 |
from soc.views import out_of_band |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
37 |
from soc.views.helper import access |
876
0c1329d4b514
Make use of the new decorators in all applicable views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
875
diff
changeset
|
38 |
from soc.views.helper import decorators |
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
39 |
from soc.views.helper import redirects |
823
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
40 |
from soc.views.helper import lists as list_helper |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
41 |
from soc.views.models import group_app |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
42 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
43 |
import soc.logic.dicts |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
44 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
45 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
46 |
class View(group_app.View): |
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
47 |
"""View methods for the Club Application model. |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
48 |
""" |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
49 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
50 |
def __init__(self, params=None): |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
51 |
"""Defines the fields and methods required for the base View class |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
52 |
to provide the user with list, public, create, edit and delete views. |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
53 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
54 |
Params: |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
55 |
params: a dict with params for this View |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
56 |
""" |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
57 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
58 |
rights = {} |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
59 |
rights['create'] = [access.checkIsUser] |
884
ded4850776c8
Changed checkIsClubAppAccepted into a more generic checkIsApplicationAccepted.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
60 |
rights['delete'] = [access.checkIsMyApplication(club_app_logic)] |
ded4850776c8
Changed checkIsClubAppAccepted into a more generic checkIsApplicationAccepted.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
61 |
rights['edit'] = [access.checkIsMyApplication(club_app_logic)] |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
62 |
rights['list'] = [access.checkIsUser] |
884
ded4850776c8
Changed checkIsClubAppAccepted into a more generic checkIsApplicationAccepted.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
882
diff
changeset
|
63 |
rights['public'] = [access.checkIsMyApplication(club_app_logic)] |
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
64 |
rights['review'] = [access.checkIsDeveloper] |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
65 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
66 |
new_params = {} |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
67 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
68 |
new_params['rights'] = rights |
882
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
876
diff
changeset
|
69 |
new_params['logic'] = club_app_logic.logic |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
70 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
71 |
new_params['create_template'] = 'soc/models/twoline_edit.html' |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
72 |
new_params['edit_template'] = 'soc/models/twoline_edit.html' |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
73 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
74 |
new_params['extra_dynaexclude'] = ['applicant', 'backup_admin', |
882
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
876
diff
changeset
|
75 |
'reviewed', 'accepted', 'application_completed', |
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
876
diff
changeset
|
76 |
'created_on', 'last_modified_on'] |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
77 |
new_params['create_extra_dynafields'] = { |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
78 |
'backup_admin_link_id': forms.CharField( |
882
267e31f1a0b6
Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
876
diff
changeset
|
79 |
label=soc.models.club_app.ClubApplication.backup_admin.verbose_name |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
80 |
), |
886
f5847f24c56e
Added clean_existing_user_not_equal_to_current to clean the backup Administrator field in an application.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
885
diff
changeset
|
81 |
'clean_backup_admin_link_id': |
f5847f24c56e
Added clean_existing_user_not_equal_to_current to clean the backup Administrator field in an application.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
885
diff
changeset
|
82 |
cleaning.clean_existing_user_not_equal_to_current('backup_admin_link_id'), |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
83 |
} |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
84 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
85 |
patterns = [(r'^%(url_name)s/(?P<access_type>review)$', |
875
03c674f510d8
Renamed showReviewOverview to review_overview and reviewOverview
Sverre Rabbelier <srabbelier@gmail.com>
parents:
858
diff
changeset
|
86 |
'soc.views.models.%(module_name)s.review_overview', |
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
87 |
'Review %(name_plural)s'), |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
88 |
(r'^%(url_name)s/(?P<access_type>review)/%(lnp)s$', |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
89 |
'soc.views.models.%(module_name)s.review', |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
90 |
'Review %(name_short)s')] |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
91 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
92 |
new_params['extra_django_patterns'] = patterns |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
93 |
|
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
94 |
new_params['name'] = "Club Application" |
803
9d0ed410bfd5
Fixed missing params in views/models/club_app.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
799
diff
changeset
|
95 |
new_params['name_plural'] = "Club Applications" |
799
30a912906a57
Construct names automatically from base name.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
798
diff
changeset
|
96 |
new_params['name_short'] = "Club App" |
803
9d0ed410bfd5
Fixed missing params in views/models/club_app.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
799
diff
changeset
|
97 |
new_params['url_name'] = "club_app" |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
98 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
99 |
new_params['sidebar_additional'] = [ |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
100 |
('/%(url_name)s/review' % new_params, |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
101 |
'Review %(name_plural)s' % new_params, 'review')] |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
102 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
103 |
new_params['review_template'] = 'soc/club_app/review.html' |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
104 |
|
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
105 |
params = dicts.merge(params, new_params) |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
106 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
107 |
super(View, self).__init__(params=params) |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
108 |
|
876
0c1329d4b514
Make use of the new decorators in all applicable views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
875
diff
changeset
|
109 |
@decorators.merge_params |
0c1329d4b514
Make use of the new decorators in all applicable views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
875
diff
changeset
|
110 |
@decorators.check_access |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
111 |
def list(self, request, access_type, |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
112 |
page_name=None, params=None, filter=None): |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
113 |
"""Lists all notifications that the current logged in user has stored. |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
114 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
115 |
for parameters see base.list() |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
116 |
""" |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
117 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
118 |
# get the current user |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
119 |
user_entity = user_logic.logic.getForCurrentAccount() |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
120 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
121 |
is_developer = accounts.isDeveloper(user=user_entity) |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
122 |
|
823
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
123 |
filter = { |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
124 |
'application_completed': False, |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
125 |
'reviewed': False, |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
126 |
} |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
127 |
|
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
128 |
if not is_developer: |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
129 |
# only select the applications for this user so construct a filter |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
130 |
filter['applicant'] = user_entity |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
131 |
|
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
132 |
# Get all the pending applications |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
133 |
|
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
134 |
pa_params = params.copy() # pending applications |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
135 |
|
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
136 |
if is_developer: |
823
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
137 |
pa_params['list_description'] = ugettext_lazy( |
836
1abdbedf4208
Add missing 'of' word to list description strings in soc.views.models.club_app module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
823
diff
changeset
|
138 |
"An overview of all pending club applications.") |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
139 |
else: |
823
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
140 |
pa_params['list_description'] = ugettext_lazy( |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
141 |
"An overview of your pending club applications.") |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
142 |
|
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
143 |
pa_list = list_helper.getListContent( |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
144 |
request, pa_params, filter, 0) |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
145 |
|
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
146 |
# Get all the reviewed applications now |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
147 |
|
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
148 |
# Re-use the old filter, but set to only reviewed and accepted |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
149 |
filter['reviewed'] = True |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
150 |
filter['accepted'] = True |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
151 |
|
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
152 |
aa_params = params.copy() # accepted applications |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
153 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
154 |
if is_developer: |
823
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
155 |
aa_params['list_description'] = ugettext_lazy( |
836
1abdbedf4208
Add missing 'of' word to list description strings in soc.views.models.club_app module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
823
diff
changeset
|
156 |
"An overview of all accepted club applications.") |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
157 |
else: |
823
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
158 |
aa_params['list_description'] = ugettext_lazy( |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
159 |
"An overview of your accepted club applications.") |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
160 |
|
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
161 |
aa_params['url_name'] = 'club' |
885
f46b689e19eb
Changed the redirect in club application overview to the correct page.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
884
diff
changeset
|
162 |
aa_params['list_action'] = (redirects.getApplicantRedirect, aa_params) |
823
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
163 |
|
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
164 |
aa_list = list_helper.getListContent( |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
165 |
request, aa_params, filter, 1) |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
166 |
|
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
167 |
# Get all the reviewd applications that were denied |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
168 |
|
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
169 |
# Re use the old filter, but this time only for denied apps |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
170 |
filter['accepted'] = False |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
171 |
|
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
172 |
da_params = params.copy() # denied applications |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
173 |
|
823
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
174 |
if is_developer: |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
175 |
da_params['list_description'] = ugettext_lazy( |
836
1abdbedf4208
Add missing 'of' word to list description strings in soc.views.models.club_app module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
823
diff
changeset
|
176 |
"An overview of all denied club applications.") |
823
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
177 |
else: |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
178 |
da_params['list_description'] = ugettext_lazy( |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
179 |
"An overview of your denied club applications.") |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
180 |
|
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
181 |
da_list = list_helper.getListContent( |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
182 |
request, da_params, filter, 2) |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
183 |
|
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
184 |
# fill contents with all the needed lists |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
185 |
contents = [pa_list, aa_list, da_list] |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
186 |
|
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
187 |
# call the _list method from base to display the list |
c11a103f103d
Add a 'pending/accepted/denied' seperation to club_app list
Sverre Rabbelier <srabbelier@gmail.com>
parents:
821
diff
changeset
|
188 |
return self._list(request, params, contents, page_name) |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
189 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
190 |
def _editGet(self, request, entity, form): |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
191 |
"""See base.View._editGet(). |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
192 |
""" |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
193 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
194 |
form.fields['backup_admin_link_id'].initial = entity.backup_admin.link_id |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
195 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
196 |
def _editPost(self, request, entity, fields): |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
197 |
"""See base.View._editPost(). |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
198 |
""" |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
199 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
200 |
fields['backup_admin'] = fields['backup_admin_link_id'] |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
201 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
202 |
if not entity: |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
203 |
fields['applicant'] = user_logic.logic.getForCurrentAccount() |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
204 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
205 |
# the application has either been created or edited so |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
206 |
# the review status needs to be set accordingly |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
207 |
fields['reviewed'] = False |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
208 |
fields['accepted'] = False |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
209 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
210 |
def _public(self, request, entity, context): |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
211 |
"""See base._public(). |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
212 |
""" |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
213 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
214 |
context['entity_type_url'] = self._params['url_name'] |
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
215 |
|
876
0c1329d4b514
Make use of the new decorators in all applicable views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
875
diff
changeset
|
216 |
@decorators.merge_params |
0c1329d4b514
Make use of the new decorators in all applicable views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
875
diff
changeset
|
217 |
@decorators.check_access |
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
218 |
def review(self, request, access_type, |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
219 |
page_name=None, params=None, **kwargs): |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
220 |
"""Handles the view containing the review of an application. |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
221 |
|
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
222 |
accepted (true or false) in the GET data will mark |
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
223 |
the application accordingly. |
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
224 |
|
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
225 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
226 |
For params see base.View.public(). |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
227 |
""" |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
228 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
229 |
# create default template context for use with any templates |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
230 |
context = helper.responses.getUniversalContext(request) |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
231 |
context['page_name'] = page_name |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
232 |
entity = None |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
233 |
|
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
234 |
try: |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
235 |
key_fields = self._logic.getKeyFieldsFromDict(kwargs) |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
236 |
entity = self._logic.getIfFields(key_fields) |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
237 |
except out_of_band.Error, error: |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
238 |
return helper.responses.errorResponse( |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
239 |
error, request, template=params['error_public'], context=context) |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
240 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
241 |
get_dict = request.GET |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
242 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
243 |
# check to see if we can make a decision for this application |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
244 |
if 'accepted' in get_dict.keys(): |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
245 |
accepted_value = get_dict['accepted'] |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
246 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
247 |
fields = {'reviewed' : False} |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
248 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
249 |
if accepted_value == 'true': |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
250 |
# the application has been accepted |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
251 |
fields['accepted'] = True |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
252 |
fields['reviewed'] = True |
821
5afe16b2e86b
Send a notifcation if a club application is accepted
Sverre Rabbelier <srabbelier@gmail.com>
parents:
818
diff
changeset
|
253 |
notifications.sendNewClubNotification(entity) |
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
254 |
elif accepted_value == 'false': |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
255 |
# the application has been denied |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
256 |
fields['accepted'] = False |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
257 |
fields['reviewed'] = True |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
258 |
|
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
259 |
if fields['reviewed']: |
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
260 |
# the application has either been denied or accepted |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
261 |
# mark it as reviewed and update accordingly |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
262 |
application = self._logic.getFromFields(link_id=kwargs['link_id']) |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
263 |
self._logic.updateModelProperties(application, fields) |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
264 |
|
875
03c674f510d8
Renamed showReviewOverview to review_overview and reviewOverview
Sverre Rabbelier <srabbelier@gmail.com>
parents:
858
diff
changeset
|
265 |
return self.reviewOverview(request, access_type, |
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
266 |
page_name=page_name, params=params, **kwargs) |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
267 |
|
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
268 |
# the application has not been reviewed so show the information |
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
269 |
# using the appropriate review template |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
270 |
params['public_template'] = params['review_template'] |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
271 |
|
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
272 |
return super(View, self).public(request, access_type, |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
273 |
page_name=page_name, params=params, **kwargs) |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
274 |
|
876
0c1329d4b514
Make use of the new decorators in all applicable views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
875
diff
changeset
|
275 |
@decorators.merge_params |
0c1329d4b514
Make use of the new decorators in all applicable views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
875
diff
changeset
|
276 |
@decorators.check_access |
875
03c674f510d8
Renamed showReviewOverview to review_overview and reviewOverview
Sverre Rabbelier <srabbelier@gmail.com>
parents:
858
diff
changeset
|
277 |
def reviewOverview(self, request, access_type, |
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
278 |
page_name=None, params=None, **kwargs): |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
279 |
"""Displays multiple lists of applications that are in different |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
280 |
states of the application process. |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
281 |
""" |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
282 |
|
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
283 |
params = dicts.merge(params, self._params) |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
284 |
|
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
285 |
# only select the requests that haven't been reviewed yet |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
286 |
filter = {'reviewed' : False} |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
287 |
|
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
288 |
ur_params = params.copy() |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
289 |
ur_params['list_description'] = ugettext_lazy('A list of all unhandled ' |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
290 |
'applications.') |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
291 |
ur_params ['list_action'] = (redirects.getReviewRedirect, params) |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
292 |
|
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
293 |
ur_list = helper.lists.getListContent( |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
294 |
request, ur_params, filter, 0) |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
295 |
|
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
296 |
# only select the requests that haven't been turned into a group yet |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
297 |
filter = {'accepted' : True, |
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
298 |
'application_completed' : False} |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
299 |
|
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
300 |
uh_params = params.copy() |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
301 |
uh_params['list_description'] = ugettext_lazy('A list of all applications ' |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
302 |
'that have been accepted but not turned into a Club yet') |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
303 |
uh_params ['list_action'] = (redirects.getReviewRedirect, params) |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
304 |
|
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
305 |
uh_list = helper.lists.getListContent( |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
306 |
request, uh_params, filter, 0) |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
307 |
|
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
308 |
#only select the requests the have been denied |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
309 |
filter = {'reviewed' : True, |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
310 |
'accepted' : False} |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
311 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
312 |
den_params = params.copy() |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
313 |
den_params['list_description'] = ugettext_lazy('A list of all applications ' |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
314 |
'that have been denied') |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
315 |
den_params ['list_action'] = (redirects.getReviewRedirect, params) |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
316 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
317 |
den_list = helper.lists.getListContent( |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
318 |
request, den_params, filter, 0) |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
319 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
320 |
# fill contents with all the needed lists |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
321 |
contents = [ur_list, uh_list, den_list] |
818
ddd102e82107
Fixed whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents:
803
diff
changeset
|
322 |
|
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
323 |
# call the _list method from base to display the list |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
324 |
return self._list(request, params, contents, page_name) |
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
325 |
|
791
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
326 |
view = View() |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
327 |
|
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
328 |
create = view.create |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
329 |
delete = view.delete |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
330 |
edit = view.edit |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
331 |
list = view.list |
30da180c4bca
Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
332 |
public = view.public |
858
e79e7a22326f
Add an export() view, and implement it as text/text for Document.
Todd Larsen <tlarsen@google.com>
parents:
836
diff
changeset
|
333 |
export = view.export |
797
0bc3f950d7cf
Added basic review functionality for club applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
791
diff
changeset
|
334 |
review = view.review |
875
03c674f510d8
Renamed showReviewOverview to review_overview and reviewOverview
Sverre Rabbelier <srabbelier@gmail.com>
parents:
858
diff
changeset
|
335 |
review_overview = view.reviewOverview |
858
e79e7a22326f
Add an export() view, and implement it as text/text for Document.
Todd Larsen <tlarsen@google.com>
parents:
836
diff
changeset
|
336 |