# HG changeset patch # User Lennard de Rijk # Date 1227380312 0 # Node ID 4db464032b25ad347d3092a77ab8df63b0076ad0 # Parent a32be584ee04b8aa2d20f815c7ee33ef208b8671 Added a requests overview using the new multi-list page. Renamed the roles page to Requests Overview. Patch by: Lennard de Rijk diff -r a32be584ee04 -r 4db464032b25 app/soc/views/models/request.py --- a/app/soc/views/models/request.py Sat Nov 22 18:22:36 2008 +0000 +++ b/app/soc/views/models/request.py Sat Nov 22 18:58:32 2008 +0000 @@ -144,21 +144,36 @@ properties = {'account': users.get_current_user()} user_entity = user_logic.logic.getForFields(properties, unique=True) - # TODO(ljvderijk): Construct the Unhandled Request list + # construct the Unhandled Requests list # only select the requests for this user that haven't been handled yet filter = {'requester': user_entity, - 'accepted' : True, - 'declined' : False} + 'declined' : None} + + uh_params = params.copy() + uh_params['list_action'] = (self.inviteAcceptedRedirect, None) + uh_params['list_description'] = ugettext_lazy( + "An overview of your unhandled requests") - params['list_action'] = (self.inviteAcceptedRedirect, None) - params['list_description'] = "An overview of your unhandled requests" + uh_list = helper.lists.getListContent(request, uh_params, self._logic, filter) - uh = helper.lists.getListContent(request, params, self._logic, filter) - - # TODO(ljvderijk): Construct the other Request lists here - - contents = [uh] + # construct the Open Requests list + + # only select the requests for the user + # that haven't been accepted by an admin yet + filter = {'requester' : user_entity, + 'accepted' : None} + + ar_params = params.copy() + ar_params['list_description'] = ugettext_lazy( + "An overview of your requests, that haven't been handled by an admin yet") + + ar_list = helper.lists.getListContent(request, ar_params, self._logic, filter) + + # fill contents with all the needed lists + contents = [uh_list,ar_list] + + # call the _list method from base to display the list return self._list(request, params, contents, page_name) def inviteAcceptedRedirect(self, entity, _): @@ -191,10 +206,6 @@ # fill in the account field with the user created from email fields['user_ln'] = fields['requester'].link_id fields['group_ln'] = fields['to'].link_id - - # make declined explicitly false when not specified - if 'declined' not in fields: - fields['declined'] = False view = View() diff -r a32be584ee04 -r 4db464032b25 app/soc/views/models/user.py --- a/app/soc/views/models/user.py Sat Nov 22 18:22:36 2008 +0000 +++ b/app/soc/views/models/user.py Sat Nov 22 18:58:32 2008 +0000 @@ -310,7 +310,7 @@ patterns += [(r'^' + self._params['url_name'] + '/edit$', 'soc.views.models.user.edit_self')] - page_name = "Unhandled Requests" + page_name = "Requests Overview" patterns += [(r'^' + self._params['url_name'] + '/roles$', 'soc.views.models.request.list_self', {'page_name': page_name}, page_name)]