app/soc/modules/ghop/views/models/task.py
changeset 3026 75ef22dc5a8a
parent 3018 0653f924ee7e
child 3027 a223fff4cca8
--- a/app/soc/modules/ghop/views/models/task.py	Sun Oct 18 17:10:01 2009 +0200
+++ b/app/soc/modules/ghop/views/models/task.py	Thu Oct 22 09:50:10 2009 +0200
@@ -415,44 +415,29 @@
       return helper.responses.errorResponse(
           error, request, context=context)
 
-    user_account = user_logic.logic.getForCurrentAccount()
-
-    filter = {
-        'user': user_account,
-        }
-
     # extend edit_form to include difficulty levels
     params['edit_form'] = self._getTagsForProgram(
         'edit_form', params, **kwargs)
 
-    org_admin_entities = ghop_org_admin_logic.logic.getForFields(filter) 
-
-    if entity and entity.status == 'Unapproved':
-      approval_req = True 
-      for org_admin_entity in org_admin_entities:
-        if org_admin_entity.key().name() == entity.created_by.key().name():
-          approval_req = False
-          break
+    if entity.status == 'Unapproved':
+      dynafields = [
+          {'name': 'approved',
+           'required': False,
+           'initial': False,
+           'base': forms.fields.BooleanField,
+           'label': 'Approve the task',
+           'help_text': 'By ticking this box, the task will be'
+               'will be approved for publishing.',
+          }
+          ]
 
-      if approval_req:
-        dynafields = [
-            {'name': 'approved',
-             'required': False,
-             'initial': False,
-             'base': forms.fields.BooleanField,
-             'label': 'Approve the task',
-             'help_text': 'By ticking this box, the task will be'
-                 'will be approved for publishing.',
-            }
-            ]
+      dynaproperties = params_helper.getDynaFields(dynafields)
 
-        dynaproperties = params_helper.getDynaFields(dynafields)
+      edit_form = dynaform.extendDynaForm(
+          dynaform=params['edit_form'],
+          dynaproperties=dynaproperties)
 
-        edit_form = dynaform.extendDynaForm(
-            dynaform=params['edit_form'],
-            dynaproperties=dynaproperties)
-
-        params['edit_form'] = edit_form
+      params['edit_form'] = edit_form
 
     if request.method == 'POST':
       return self.editPost(request, entity, context, params=params)
@@ -642,6 +627,8 @@
     if entity:
       entity = logic.updateEntityProperties(entity, fields)
     else:
+      # TODO: Redirect to standard edit page which already has the ability to
+      # hide certain fields.
       entity = logic.updateOrCreateFromFields(fields)
 
     page_params = params['edit_params']