app/soc/modules/ghop/views/models/task.py
changeset 3091 a48f4e860f7b
parent 3059 14421976288a
equal deleted inserted replaced
3090:cdbbe9ca465e 3091:a48f4e860f7b
    17 """Views for Tasks.
    17 """Views for Tasks.
    18 """
    18 """
    19 
    19 
    20 __authors__ = [
    20 __authors__ = [
    21     '"Madhusudan.C.S" <madhusudancs@gmail.com>',
    21     '"Madhusudan.C.S" <madhusudancs@gmail.com>',
       
    22     '"Daniel Hans" <daniel.m.hans@gmail.com>',
    22     '"Lennard de Rijk" <ljvderijk@gmail.com>',
    23     '"Lennard de Rijk" <ljvderijk@gmail.com>',
    23   ]
    24   ]
    24 
    25 
    25 
    26 
    26 import datetime
    27 import datetime
   155     rights['edit'] = [
   156     rights['edit'] = [
   156         ('checkCanOrgAdminOrMentorEdit', ['scope_path', False]),
   157         ('checkCanOrgAdminOrMentorEdit', ['scope_path', False]),
   157         ('checkRoleAndStatusForTask',
   158         ('checkRoleAndStatusForTask',
   158             [['ghop/org_admin'], ['active'],
   159             [['ghop/org_admin'], ['active'],
   159             ['Unapproved', 'Unpublished', 'Open']])]
   160             ['Unapproved', 'Unpublished', 'Open']])]
   160     rights['delete'] = ['checkIsDeveloper']
   161     rights['delete'] = [
       
   162         ('checkRoleAndStatusForTask', 
       
   163             [['ghop/org_admin'], ['active'],
       
   164             ['Unapproved', 'Unpublished', 'Open']])]
   161     rights['show'] = ['checkStatusForTask']
   165     rights['show'] = ['checkStatusForTask']
   162     rights['list_org_tasks'] = [
   166     rights['list_org_tasks'] = [
   163         ('checkCanOrgAdminOrMentorEdit', ['scope_path', False])]
   167         ('checkCanOrgAdminOrMentorEdit', ['scope_path', False])]
   164     rights['suggest_task'] = [
   168     rights['suggest_task'] = [
   165         ('checkCanOrgAdminOrMentorEdit', ['scope_path', True]),
   169         ('checkCanOrgAdminOrMentorEdit', ['scope_path', True]),
  1440       contents.append(task_list)
  1444       contents.append(task_list)
  1441 
  1445 
  1442     # call the _list method from base to display the list
  1446     # call the _list method from base to display the list
  1443     return self._list(request, task_params, contents, page_name, context)
  1447     return self._list(request, task_params, contents, page_name, context)
  1444 
  1448 
       
  1449   @decorators.merge_params
       
  1450   @decorators.check_access
       
  1451   def delete(self, request, access_type,
       
  1452              page_name=None, params=None, **kwargs):
       
  1453     """Shows the delete page for the entity specified by **kwargs.
       
  1454 
       
  1455     Args:
       
  1456       request: the standard Django HTTP request object
       
  1457       access_type : the name of the access type which should be checked
       
  1458       page_name: the page name displayed in templates as page and header title
       
  1459       params: a dict with params for this View
       
  1460       kwargs: the Key Fields for the specified entity
       
  1461     """
       
  1462 
       
  1463     params = params.copy()
       
  1464 
       
  1465     params['delete_redirect'] = '/%s/list_org_tasks/%s' % (
       
  1466         params['url_name'], kwargs['scope_path'])
       
  1467 
       
  1468     return super(View, self).delete(request, access_type, page_name=page_name,
       
  1469         params=params, **kwargs)
       
  1470 
  1445 
  1471 
  1446 view = View()
  1472 view = View()
  1447 
  1473 
  1448 create = decorators.view(view.create)
  1474 create = decorators.view(view.create)
  1449 delete = decorators.view(view.delete)
  1475 delete = decorators.view(view.delete)