app/soc/views/models/request.py
changeset 822 f37fed16c388
parent 799 30a912906a57
child 858 e79e7a22326f
equal deleted inserted replaced
821:5afe16b2e86b 822:f37fed16c388
    54   class Meta:
    54   class Meta:
    55     """Inner Meta class that defines some behavior for the form.
    55     """Inner Meta class that defines some behavior for the form.
    56     """
    56     """
    57     model = soc.models.request.Request
    57     model = soc.models.request.Request
    58 
    58 
    59     #: list of model fields which will *not* be gathered by the form 
    59     #: list of model fields which will *not* be gathered by the form
    60     exclude = ['scope', 'scope_path', 'link_id', 'role', 'declined']
    60     exclude = ['scope', 'scope_path', 'link_id', 'role', 'declined']
    61 
    61 
    62   role = forms.CharField(widget=helper.widgets.ReadOnlyInput())
    62   role = forms.CharField(widget=helper.widgets.ReadOnlyInput())
    63 
    63 
    64   user = forms.CharField(
    64   user = forms.CharField(
   119     new_params['save_message'] = [ugettext_lazy('Request saved.')]
   119     new_params['save_message'] = [ugettext_lazy('Request saved.')]
   120 
   120 
   121     params = dicts.merge(params, new_params)
   121     params = dicts.merge(params, new_params)
   122 
   122 
   123     super(View, self).__init__(params=params)
   123     super(View, self).__init__(params=params)
   124     
   124 
   125     
   125 
   126   def listSelf(self, request, access_type,
   126   def listSelf(self, request, access_type,
   127                page_name=None, params=None, **kwargs):
   127                page_name=None, params=None, **kwargs):
   128     """Displays the unhandled requests for this user.
   128     """Displays the unhandled requests for this user.
   129 
   129 
   130     Args:
   130     Args:
   149     # construct the Unhandled Requests list
   149     # construct the Unhandled Requests list
   150 
   150 
   151     # only select the requests for this user that haven't been handled yet
   151     # only select the requests for this user that haven't been handled yet
   152     filter = {'link_id': user_entity.link_id,
   152     filter = {'link_id': user_entity.link_id,
   153               'group_accepted' : True}
   153               'group_accepted' : True}
   154     
   154 
   155     uh_params = params.copy()
   155     uh_params = params.copy()
   156     uh_params['list_action'] = (redirects.inviteAcceptedRedirect, None)
   156     uh_params['list_action'] = (redirects.inviteAcceptedRedirect, None)
   157     uh_params['list_description'] = ugettext_lazy(
   157     uh_params['list_description'] = ugettext_lazy(
   158         "An overview of your unhandled requests.")
   158         "An overview of your unhandled requests.")
   159 
   159 
   160     uh_list = helper.lists.getListContent(
   160     uh_list = helper.lists.getListContent(
   161         request, uh_params, filter, 0)
   161         request, uh_params, filter, 0)
   162 
   162 
   163     # construct the Open Requests list
   163     # construct the Open Requests list
   164     
   164 
   165     # only select the requests for the user
   165     # only select the requests for the user
   166     # that haven't been accepted by an admin yet
   166     # that haven't been accepted by an admin yet
   167     filter = {'link_id' : user_entity.link_id,
   167     filter = {'link_id' : user_entity.link_id,
   168               'group_accepted' : False}
   168               'group_accepted' : False}
   169     
   169 
   170     ar_params = params.copy()
   170     ar_params = params.copy()
   171     ar_params['list_description'] = ugettext_lazy(
   171     ar_params['list_description'] = ugettext_lazy(
   172         "List of your pending requests.")
   172         "List of your pending requests.")
   173     
   173 
   174     ar_list = helper.lists.getListContent(
   174     ar_list = helper.lists.getListContent(
   175         request, ar_params, filter, 1)
   175         request, ar_params, filter, 1)
   176     
   176 
   177     # fill contents with all the needed lists
   177     # fill contents with all the needed lists
   178     contents = [uh_list, ar_list]
   178     contents = [uh_list, ar_list]
   179     
   179 
   180     # call the _list method from base to display the list
   180     # call the _list method from base to display the list
   181     return self._list(request, params, contents, page_name)
   181     return self._list(request, params, contents, page_name)
   182 
   182 
   183   def _editSeed(self, request, seed):
   183   def _editSeed(self, request, seed):
   184     """See base.View._editGet().
   184     """See base.View._editGet().