app/soc/views/models/request.py
changeset 982 9efcedcfeb3e
parent 970 8b5611d5b053
child 986 e9611a2288ca
equal deleted inserted replaced
981:61a6a8d304dc 982:9efcedcfeb3e
   101     patterns = [(r'^%(url_name)s/(?P<access_type>invite)/%(lnp)s$',
   101     patterns = [(r'^%(url_name)s/(?P<access_type>invite)/%(lnp)s$',
   102         'soc.views.models.%(module_name)s.invite',
   102         'soc.views.models.%(module_name)s.invite',
   103         'Create invite for %(name_plural)s'),
   103         'Create invite for %(name_plural)s'),
   104         (r'^%(url_name)s/(?P<access_type>process_invite)/%(key_fields)s$',
   104         (r'^%(url_name)s/(?P<access_type>process_invite)/%(key_fields)s$',
   105           'soc.views.models.%(module_name)s.process_invite',
   105           'soc.views.models.%(module_name)s.process_invite',
   106           'Process Invite to for a Role')]
   106           'Process Invite to become')]
   107 
   107 
   108     new_params['extra_django_patterns'] = patterns
   108     new_params['extra_django_patterns'] = patterns
   109     
   109     
   110     new_params['invite_processing_template'] = 'soc/request/process_invite.html'
   110     new_params['invite_processing_template'] = 'soc/request/process_invite.html'
   111     new_params['request_processing_template'] = 'soc/request/process_request.html'
   111     new_params['request_processing_template'] = 'soc/request/process_request.html'
   144       kwargs: the Key Fields for the specified entity
   144       kwargs: the Key Fields for the specified entity
   145     """
   145     """
   146 
   146 
   147     # get the context for this webpage
   147     # get the context for this webpage
   148     context = responses.getUniversalContext(request)
   148     context = responses.getUniversalContext(request)
   149     context['page_name'] = page_name
       
   150     
   149     
   151     request_logic = params['logic']
   150     request_logic = params['logic']
   152 
   151 
   153     # get the request entity using the information from kwargs
   152     # get the request entity using the information from kwargs
   154     fields = {'link_id': kwargs['link_id'],
   153     fields = {'link_id': kwargs['link_id'],
   155         'scope_path': kwargs['scope_path'],
   154         'scope_path': kwargs['scope_path'],
   156         'role': kwargs['role'],
   155         'role': kwargs['role'],
   157         'state': 'group_accepted'}
   156         'state': 'group_accepted'}
   158     request_entity = request_logic.getForFields(fields, unique=True)
   157     request_entity = request_logic.getForFields(fields, unique=True)
   159     
   158 
       
   159     # set the page name using the request_entity
       
   160     context['page_name'] = '%s %s' % (page_name, 
       
   161         request_entity.role_verbose)
       
   162 
   160     get_dict = request.GET
   163     get_dict = request.GET
   161     
   164     
   162     if 'status' in get_dict.keys():
   165     if 'status' in get_dict.keys():
   163       if get_dict['status'] == 'rejected':
   166       if get_dict['status'] == 'rejected':
   164         # this invite has been rejected mark as rejected
   167         # this invite has been rejected mark as rejected
   165         request_logic.updateModelProperties(request_entity, {
   168         request_logic.updateModelProperties(request_entity, {
   166             'state': 'rejected'})
   169             'state': 'rejected'})
   167         
   170 
   168         # redirect to user role overview
   171         # redirect to user role overview
   169         return http.HttpResponseRedirect('/user/roles')
   172         return http.HttpResponseRedirect('/user/roles')
   170 
   173 
   171     # put the entity in the context
   174     # put the entity in the context
   172     context['entity'] = request_entity
   175     context['entity'] = request_entity