Make it possible to add some default values to the context
authorSverre Rabbelier <srabbelier@gmail.com>
Thu, 05 Mar 2009 19:20:02 +0000
changeset 1677 b2cf6ad50a2a
parent 1676 a3c33bef2ea8
child 1678 80411f57f31a
Make it possible to add some default values to the context Currently only used in show, but easy enough to add elsewhere. Patch by: Sverre Rabbelier
app/soc/views/helper/params.py
app/soc/views/models/base.py
--- a/app/soc/views/helper/params.py	Thu Mar 05 17:44:48 2009 +0000
+++ b/app/soc/views/helper/params.py	Thu Mar 05 19:20:02 2009 +0000
@@ -225,6 +225,8 @@
   new_params['list_template'] = 'soc/models/list.html'
   new_params['invite_template'] = 'soc/models/invite.html'
 
+  new_params['context'] = None
+
   new_params['export_content_type'] = None
   new_params['export_extension'] = '.txt'
 
--- a/app/soc/views/models/base.py	Thu Mar 05 17:44:48 2009 +0000
+++ b/app/soc/views/models/base.py	Thu Mar 05 19:20:02 2009 +0000
@@ -122,6 +122,8 @@
     context['entity_type'] = params['name']
     context['entity_type_url'] = params['url_name']
 
+    context = dicts.merge(params['context'], context)
+
     template = params['public_template']
 
     return helper.responses.respond(request, template, context=context)