Swap order of merged params to fix sponsor select view
authorSverre Rabbelier <srabbelier@gmail.com>
Tue, 02 Dec 2008 17:59:44 +0000
changeset 647 355ac73823a1
parent 646 860e17e5118f
child 648 4f879defb15b
Swap order of merged params to fix sponsor select view The sponsor select view (in 'create new program') was showing the wrong information (and also using the wrong list template) because the order in which the params were merged was wrong way around. This fixes that and at the same time fixes the 'instruction_text' attribute, which should be named 'list_description' instead. At the same time we lookup and set Sponsor as the scope of the newly created program. Patch by: Sverre Rabbelier
app/soc/views/models/program.py
app/soc/views/models/role.py
--- a/app/soc/views/models/program.py	Tue Dec 02 17:14:18 2008 +0000
+++ b/app/soc/views/models/program.py	Tue Dec 02 17:59:44 2008 +0000
@@ -115,11 +115,11 @@
 
     new_params = {}
     new_params['list_action'] = (redirects.getCreateProgramRedirect, params)
-    new_params['instruction_text'] = \
+    new_params['list_description'] = \
         self.DEF_CREATE_INSTRUCTION_MSG_FMT % self._params
 
+    new_params = dicts.merge(new_params, sponsor_view.view._params)
     params = dicts.merge(new_params, params)
-    params = dicts.merge(params, sponsor_view.view._params)
 
     content = helper.lists.getListContent(request, params, sponsor_logic.logic)
     contents = [content]
@@ -133,6 +133,14 @@
     # fill in the email field with the data from the entity
     form.fields['scope_path'].initial = entity.scope_path
 
+  def _editPost(self, request, entity, fields):
+    """See base.View._editPost().
+    """
+
+    sponsor = sponsor_logic.logic.getFromFields(link_id=fields['scope_path'])
+    fields['scope'] = sponsor
+
+
   def getDjangoURLPatterns(self, params=None):
     """See base.View.getDjangoURLPatterns().
     """
--- a/app/soc/views/models/role.py	Tue Dec 02 17:14:18 2008 +0000
+++ b/app/soc/views/models/role.py	Tue Dec 02 17:59:44 2008 +0000
@@ -93,7 +93,7 @@
     new_params['list_action'] = (redirects.getCreateRequestRedirect, 
         {'group_scope' : group_scope,
         'url_name' : self._params['url_name'] })
-    new_params['instruction_text'] = \
+    new_params['list_description'] = \
         self.DEF_INVITE_INSTRUCTION_MSG_FMT % self._params
 
     new_params = dicts.merge(new_params, params)