Removed query wether or not the current user was ever an org admin.
This is because it makes no sense to not show the approve this task button if th
is task was suggested by an org admin. The suggest page is there for a reason fo
staging tasks anyway.
Also added TODO to let the mentor's suggest page redirect to the normal edit pag
e after a task has been suggested. This is more natural since the task lists als
o redirects to this page for unapproved tasks and the normal edit page also has
the capability to hide fields determined by the user's access.
--- 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']