app/soc/views/models/organization.py
changeset 1405 43b482f48b12
parent 1391 09a95e57caa7
child 1406 60b68fc36df2
equal deleted inserted replaced
1404:3baec5ce9911 1405:43b482f48b12
    63                            [org_admin_logic.logic, 'link_id']),
    63                            [org_admin_logic.logic, 'link_id']),
    64                       ('checkIsActive', [org_logic.logic, None])]
    64                       ('checkIsActive', [org_logic.logic, None])]
    65     rights['delete'] = ['checkIsDeveloper']
    65     rights['delete'] = ['checkIsDeveloper']
    66     rights['home'] = ['allow']
    66     rights['home'] = ['allow']
    67     rights['public_list'] = ['allow']
    67     rights['public_list'] = ['allow']
       
    68     rights['apply_mentor'] = ['checkIsUser']
    68     rights['list_requests'] = [('checkHasActiveRoleForScope', 
    69     rights['list_requests'] = [('checkHasActiveRoleForScope', 
    69                                 [org_admin_logic.logic, 'link_id'])]
    70                                 [org_admin_logic.logic, 'link_id'])]
    70     rights['list_roles'] = [('checkHasActiveRoleForScope', 
    71     rights['list_roles'] = [('checkHasActiveRoleForScope', 
    71                              [org_admin_logic.logic, 'link_id'])]
    72                              [org_admin_logic.logic, 'link_id'])]
    72     rights['applicant'] = [('checkIsApplicationAccepted',
    73     rights['applicant'] = [('checkIsApplicationAccepted',
    89     new_params['list_heading'] = 'soc/organization/list/heading.html'
    90     new_params['list_heading'] = 'soc/organization/list/heading.html'
    90 
    91 
    91     new_params['application_logic'] = org_app_logic
    92     new_params['application_logic'] = org_app_logic
    92     new_params['group_applicant_url'] = True
    93     new_params['group_applicant_url'] = True
    93     new_params['sans_link_id_public_list'] = True
    94     new_params['sans_link_id_public_list'] = True
       
    95 
       
    96     patterns = []
       
    97 
       
    98     patterns += [(r'^%(url_name)s/(?P<access_type>apply_mentor)/%(scope)s$',
       
    99         'soc.views.models.%(module_name)s.apply_mentor', 
       
   100         "List of all %(name_plural)s you can apply to"),]
       
   101 
       
   102     new_params['extra_django_patterns'] = patterns
    94 
   103 
    95     new_params['create_extra_dynafields'] = {
   104     new_params['create_extra_dynafields'] = {
    96         'scope_path': forms.CharField(widget=forms.HiddenInput,
   105         'scope_path': forms.CharField(widget=forms.HiddenInput,
    97                                    required=True),
   106                                    required=True),
    98         'clean_ideas': cleaning.clean_url('ideas'),
   107         'clean_ideas': cleaning.clean_url('ideas'),
   121 
   130 
   122     params['applicant_create_form'] = applicant_create_form
   131     params['applicant_create_form'] = applicant_create_form
   123 
   132 
   124   @decorators.merge_params
   133   @decorators.merge_params
   125   @decorators.check_access
   134   @decorators.check_access
       
   135   def applyMentor(self, request, access_type,
       
   136                   page_name=None, params=None, **kwargs):
       
   137     """Shows a list of all organizations and you can choose one to 
       
   138        apply to become a mentor.
       
   139 
       
   140     Args:
       
   141       request: the standard Django HTTP request object
       
   142       access_type : the name of the access type which should be checked
       
   143       page_name: the page name displayed in templates as page and header title
       
   144       params: a dict with params for this View
       
   145       kwargs: the Key Fields for the specified entity
       
   146     """
       
   147 
       
   148     list_params = params.copy()
       
   149     list_params['list_action'] = (redirects.getRequestRedirectForRole, 'mentor')
       
   150     list_params['list_description'] = ('Choose an Organization which '
       
   151         'you want to become a Mentor for.')
       
   152 
       
   153     filter = {'scope_path': kwargs['scope_path'],
       
   154               'status' : 'active'}
       
   155 
       
   156     return self.list(request, access_type, 
       
   157         page_name, params=list_params, filter=filter)
       
   158 
       
   159   @decorators.merge_params
       
   160   @decorators.check_access
   126   def listPublic(self, request, access_type, page_name=None,
   161   def listPublic(self, request, access_type, page_name=None,
   127            params=None, filter=None, **kwargs):
   162            params=None, filter=None, **kwargs):
   128     """See base.View.list.
   163     """See base.View.list.
   129     """
   164     """
   130 
   165 
   221 
   256 
   222 view = View()
   257 view = View()
   223 
   258 
   224 admin = view.admin
   259 admin = view.admin
   225 applicant = view.applicant
   260 applicant = view.applicant
       
   261 apply_mentor = view.applyMentor
   226 create = view.create
   262 create = view.create
   227 delete = view.delete
   263 delete = view.delete
   228 edit = view.edit
   264 edit = view.edit
   229 home = view.home
   265 home = view.home
   230 list = view.list
   266 list = view.list