app/soc/views/models/base.py
changeset 1296 64918d0c97ea
parent 1269 62b1e9ee46c5
child 1304 b736aed728c2
equal deleted inserted replaced
1295:b3b2025f4ffb 1296:64918d0c97ea
   423     content = helper.lists.getListContent(request, params, filter)
   423     content = helper.lists.getListContent(request, params, filter)
   424     contents = [content]
   424     contents = [content]
   425 
   425 
   426     return self._list(request, params, contents, page_name)
   426     return self._list(request, params, contents, page_name)
   427 
   427 
   428   def _list(self, request, params, contents, page_name):
   428   def _list(self, request, params, contents, page_name, context={}):
   429     """Returns the list page for the specified contents.
   429     """Returns the list page for the specified contents.
   430 
   430 
   431     Args:
   431     Args:
   432       request: the standard Django HTTP request object
   432       request: the standard Django HTTP request object
   433       params: a dict with params for this View
   433       params: a dict with params for this View
   434       contents: a list of content dicts
   434       contents: a list of content dicts
   435       page_name: the page name displayed in templates as page and header title
   435       page_name: the page name displayed in templates as page and header title
       
   436       context: the context for this page
   436 
   437 
   437     Params usage:
   438     Params usage:
   438       name: The name value is used to set the entity_type in the
   439       name: The name value is used to set the entity_type in the
   439         context so that the template can refer to it.
   440         context so that the template can refer to it.
   440       name_plural: The name_plural value is used to set
   441       name_plural: The name_plural value is used to set
   442         template can refer to it.
   443         template can refer to it.
   443       list_template: The list_template value is used as template for
   444       list_template: The list_template value is used as template for
   444         to display the list of all entities for this View.
   445         to display the list of all entities for this View.
   445     """
   446     """
   446 
   447 
   447     context = helper.responses.getUniversalContext(request)
   448     context = dicts.merge(context, 
       
   449         helper.responses.getUniversalContext(request))
   448     context['page_name'] = page_name
   450     context['page_name'] = page_name
   449     context['list'] = soc.logic.lists.Lists(contents)
   451     context['list'] = soc.logic.lists.Lists(contents)
   450 
   452 
   451     context['entity_type'] = params['name']
   453     context['entity_type'] = params['name']
   452     context['entity_type_plural'] = params['name_plural']
   454     context['entity_type_plural'] = params['name_plural']