app/soc/views/models/program.py
changeset 652 02323664d532
parent 651 ef6e22d463cb
child 653 5105939d3bb4
equal deleted inserted replaced
651:ef6e22d463cb 652:02323664d532
    39 
    39 
    40 
    40 
    41 class View(base.View):
    41 class View(base.View):
    42   """View methods for the Sponsor model.
    42   """View methods for the Sponsor model.
    43   """
    43   """
    44 
       
    45   DEF_CREATE_INSTRUCTION_MSG_FMT = ugettext_lazy(
       
    46       'Please use this form to select a Sponsor for the new Program')
       
    47 
    44 
    48   def __init__(self, original_params=None):
    45   def __init__(self, original_params=None):
    49     """Defines the fields and methods required for the base View class
    46     """Defines the fields and methods required for the base View class
    50     to provide the user with list, public, create, edit and delete views.
    47     to provide the user with list, public, create, edit and delete views.
    51 
    48 
    89 
    86 
    90     if 'scope_path' in kwargs:
    87     if 'scope_path' in kwargs:
    91       return super(View, self).create(request, page_name=page_name,
    88       return super(View, self).create(request, page_name=page_name,
    92           params=params, **kwargs)
    89           params=params, **kwargs)
    93 
    90 
    94     params = dicts.merge(params, self._params)
       
    95     return self.selectSponsor(request, page_name, params)
    91     return self.selectSponsor(request, page_name, params)
    96 
    92 
    97   def selectSponsor(self, request, page_name, params):
    93   def selectSponsor(self, request, page_name, params):
    98     """Displays a list page allowing the user to select a Sponsor
    94     """Displays a list page allowing the user to select a Sponsor
    99 
    95 
   113       request: the standard Django HTTP request object
   109       request: the standard Django HTTP request object
   114       page_name: the page name displayed in templates as page and header title
   110       page_name: the page name displayed in templates as page and header title
   115       params: a dict with params for this View
   111       params: a dict with params for this View
   116     """
   112     """
   117 
   113 
       
   114     view = sponsor_view.view
       
   115     redirect = redirects.getCreateRedirect
       
   116 
       
   117     params = dicts.merge(params, self._params)
       
   118 
   118     new_params = {}
   119     new_params = {}
   119     new_params['list_action'] = (redirects.getCreateProgramRedirect, params)
   120     new_params['list_action'] = (redirect, params)
   120     new_params['list_description'] = \
       
   121         self.DEF_CREATE_INSTRUCTION_MSG_FMT % self._params
       
   122 
   121 
   123     new_params = dicts.merge(new_params, sponsor_view.view._params)
   122     new_params = dicts.merge(new_params, view.getParams())
   124     params = dicts.merge(new_params, params)
   123     params = dicts.merge(new_params, params)
   125 
   124 
   126     content = helper.lists.getListContent(request, params)
   125     content = helper.lists.getListContent(request, params)
   127     contents = [content]
   126     contents = [content]
   128 
   127