diff -r 3baec5ce9911 -r 43b482f48b12 app/soc/views/models/organization.py --- a/app/soc/views/models/organization.py Thu Feb 19 21:14:28 2009 +0000 +++ b/app/soc/views/models/organization.py Thu Feb 19 21:27:31 2009 +0000 @@ -65,6 +65,7 @@ rights['delete'] = ['checkIsDeveloper'] rights['home'] = ['allow'] rights['public_list'] = ['allow'] + rights['apply_mentor'] = ['checkIsUser'] rights['list_requests'] = [('checkHasActiveRoleForScope', [org_admin_logic.logic, 'link_id'])] rights['list_roles'] = [('checkHasActiveRoleForScope', @@ -92,6 +93,14 @@ new_params['group_applicant_url'] = True new_params['sans_link_id_public_list'] = True + patterns = [] + + patterns += [(r'^%(url_name)s/(?Papply_mentor)/%(scope)s$', + 'soc.views.models.%(module_name)s.apply_mentor', + "List of all %(name_plural)s you can apply to"),] + + new_params['extra_django_patterns'] = patterns + new_params['create_extra_dynafields'] = { 'scope_path': forms.CharField(widget=forms.HiddenInput, required=True), @@ -123,6 +132,32 @@ @decorators.merge_params @decorators.check_access + def applyMentor(self, request, access_type, + page_name=None, params=None, **kwargs): + """Shows a list of all organizations and you can choose one to + apply to become a mentor. + + Args: + request: the standard Django HTTP request object + access_type : the name of the access type which should be checked + page_name: the page name displayed in templates as page and header title + params: a dict with params for this View + kwargs: the Key Fields for the specified entity + """ + + list_params = params.copy() + list_params['list_action'] = (redirects.getRequestRedirectForRole, 'mentor') + list_params['list_description'] = ('Choose an Organization which ' + 'you want to become a Mentor for.') + + filter = {'scope_path': kwargs['scope_path'], + 'status' : 'active'} + + return self.list(request, access_type, + page_name, params=list_params, filter=filter) + + @decorators.merge_params + @decorators.check_access def listPublic(self, request, access_type, page_name=None, params=None, filter=None, **kwargs): """See base.View.list. @@ -223,6 +258,7 @@ admin = view.admin applicant = view.applicant +apply_mentor = view.applyMentor create = view.create delete = view.delete edit = view.edit