app/soc/views/models/base.py
changeset 1339 c007dc7d00ca
parent 1331 e6fc2238bab0
child 1342 f8056a197fb8
equal deleted inserted replaced
1338:4b8546a3b20c 1339:c007dc7d00ca
   695       context: the context dictionary that will be used
   695       context: the context dictionary that will be used
   696     """
   696     """
   697 
   697 
   698     pass
   698     pass
   699 
   699 
   700   def _constructResponse(self, request, entity, context, form, params):
   700   def _constructResponse(self, request, entity, context,
       
   701                          form, params, template=None):
   701     """Updates the context and returns a response for the specified arguments.
   702     """Updates the context and returns a response for the specified arguments.
   702 
   703 
   703     Args:
   704     Args:
   704       request: the django request object
   705       request: the django request object
   705       entity: the entity that is used and set in the context
   706       entity: the entity that is used and set in the context
   706       context: the context to be used
   707       context: the context to be used
   707       form: the form that will be used and set in the context
   708       form: the form that will be used and set in the context
   708       params: a dict with params for this View
   709       params: a dict with params for this View
       
   710       template: if specified, this template is
   709 
   711 
   710     Params usage:
   712     Params usage:
   711       name: The name_plural value is used to set the entity_type
   713       name: The name_plural value is used to set the entity_type
   712        value in the context so that the template can refer to it.
   714        value in the context so that the template can refer to it.
   713       name_plural: same as name, but used to set entity_type_plural
   715       name_plural: same as name, but used to set entity_type_plural
   733     context['return_url'] = request.path
   735     context['return_url'] = request.path
   734 
   736 
   735     if params.get('export_content_type') and entity:
   737     if params.get('export_content_type') and entity:
   736       context['export_link'] = redirects.getExportRedirect(entity, params)
   738       context['export_link'] = redirects.getExportRedirect(entity, params)
   737 
   739 
   738     if entity:
   740     if not template:
   739       template = params['edit_template']
   741       if entity:
   740     else:
   742         template = params['edit_template']
   741       template = params['create_template']
   743       else:
       
   744         template = params['create_template']
   742 
   745 
   743     self._editContext(request, context)
   746     self._editContext(request, context)
   744     return helper.responses.respond(request, template, context)
   747     return helper.responses.respond(request, template, context)
   745 
   748 
   746   def getParams(self):
   749   def getParams(self):