Added two needed redirects in role.py.
To make this work properly group_view was added to params in club_admin and club_member.
Patch by: Lennard de Rijk
Reviewed by: to-be-reviewed
--- a/app/soc/views/models/club_admin.py Sun Jan 25 16:43:15 2009 +0000
+++ b/app/soc/views/models/club_admin.py Sun Jan 25 16:50:24 2009 +0000
@@ -61,6 +61,7 @@
new_params = {}
new_params['logic'] = soc.logic.models.club_admin.logic
new_params['group_logic'] = club_logic.logic
+ new_params['group_view'] = club_view.view
new_params['rights'] = rights
new_params['scope_view'] = club_view
--- a/app/soc/views/models/club_member.py Sun Jan 25 16:43:15 2009 +0000
+++ b/app/soc/views/models/club_member.py Sun Jan 25 16:50:24 2009 +0000
@@ -62,6 +62,7 @@
new_params = {}
new_params['logic'] = soc.logic.models.club_member.logic
new_params['group_logic'] = club_logic.logic
+ new_params['group_view'] = club_view.view
new_params['rights'] = rights
new_params['scope_view'] = club_view
--- a/app/soc/views/models/host.py Sun Jan 25 16:43:15 2009 +0000
+++ b/app/soc/views/models/host.py Sun Jan 25 16:50:24 2009 +0000
@@ -71,10 +71,10 @@
new_params['rights'] = rights
new_params['logic'] = soc.logic.models.host.logic
new_params['group_logic'] = sponsor_logic.logic
+ new_params['group_view'] = soc.views.models.sponsor.view
new_params['scope_view'] = sponsor_view
- new_params['group_view'] = soc.views.models.sponsor.view
new_params['invite_filter'] = {'group_ln': 'link_id'}
new_params['name'] = "Program Administrator"
--- a/app/soc/views/models/role.py Sun Jan 25 16:43:15 2009 +0000
+++ b/app/soc/views/models/role.py Sun Jan 25 16:50:24 2009 +0000
@@ -194,8 +194,13 @@
# send out an invite notification
notifications_helper.sendInviteNotification(entity)
- # TODO(ljvderijk) redirect to a more useful place like the group homepage
- return http.HttpResponseRedirect('/')
+ group_view = params.get('group_view')
+ if not group_view:
+ return http.HttpResponseRedirect('/')
+ else:
+ # redirect to the requests list
+ return http.HttpResponseRedirect(
+ redirects.getListRequestsRedirect(group, group_view.getParams()))
def _getRequestScopePathFromGroup(self, group_entity):
"""Returns the scope_path that should be put in a request for a given group.
@@ -452,8 +457,14 @@
if request_state == 'group_accepted':
notifications_helper.sendInviteNotification(request_entity)
- # TODO(ljvderijk) redirect to group requests overview
- return http.HttpResponseRedirect('/')
+ group_view = params.get('group_view')
+ if not group_view:
+ return http.HttpResponseRedirect('/')
+ else:
+ # redirect to the requests list
+ return http.HttpResponseRedirect(
+ redirects.getListRequestsRedirect(request_entity.scope,
+ group_view.getParams()))
# put the entity in the context
context['entity'] = request_entity