# HG changeset patch # User Pawel Solyga # Date 1239041933 0 # Node ID 8c0531c9870df4bb7658a02a0e4d15d33380a7e0 # Parent 987913140e3119a33ef24fc6313539d9db66a3ab Allow students to see and comment on withdrawn and ineligible proposals, hide withdraw button for those proposals. Patch by: Pawel Solyga Reviewed by: to-be-reviewed diff -r 987913140e31 -r 8c0531c9870d app/soc/templates/soc/student_proposal/edit.html --- a/app/soc/templates/soc/student_proposal/edit.html Mon Apr 06 18:16:30 2009 +0000 +++ b/app/soc/templates/soc/student_proposal/edit.html Mon Apr 06 18:18:53 2009 +0000 @@ -16,7 +16,9 @@ {% if is_admin %} {{ block.super }} {% endif %} +{% ifnotequal entity.status "invalid" %} +{% endifnotequal %} {% endblock %} diff -r 987913140e31 -r 8c0531c9870d app/soc/views/models/student_proposal.py --- a/app/soc/views/models/student_proposal.py Mon Apr 06 18:16:30 2009 +0000 +++ b/app/soc/views/models/student_proposal.py Mon Apr 06 18:18:53 2009 +0000 @@ -27,6 +27,7 @@ from django import forms from django import http +from django.utils.translation import ugettext from soc.logic import cleaning from soc.logic import dicts @@ -40,6 +41,7 @@ from soc.views.helper import access from soc.views.helper import decorators from soc.views.helper import dynaform +from soc.views.helper import lists from soc.views.helper import params as params_helper from soc.views.helper import redirects from soc.views.helper import responses @@ -66,13 +68,13 @@ rights['create'] = ['checkIsDeveloper'] rights['edit'] = [('checkCanStudentPropose', ['scope_path', False]), ('checkRoleAndStatusForStudentProposal', - [['proposer'], ['active'], ['new', 'pending']])] + [['proposer'], ['active'], ['new', 'pending', 'invalid']])] rights['delete'] = ['checkIsDeveloper'] rights['show'] = [ ('checkRoleAndStatusForStudentProposal', [['proposer', 'org_admin', 'mentor', 'host'], ['active', 'inactive'], - ['new', 'pending', 'accepted', 'rejected']])] + ['new', 'pending', 'accepted', 'rejected', 'invalid']])] rights['list'] = ['checkIsDeveloper'] rights['list_orgs'] = [ ('checkIsStudent', ['scope_path', ['active']]), @@ -553,24 +555,49 @@ @decorators.merge_params @decorators.check_access def listSelf(self, request, access_type, - page_name=None, params=None, **kwargs): + page_name=None, params=None, **kwargs): """Lists all proposals from the current logged-in user for the given student. For params see base.View.public(). """ + context = {} student_entity = student_logic.logic.getFromKeyName(kwargs['scope_path']) filter = {'scope' : student_entity, 'status': ['new', 'pending', 'accepted', 'rejected']} list_params = params.copy() - list_params['list_description'] = 'List of my %(name_plural)s' % list_params + list_params['list_description'] = 'List of my %(name_plural)s.' % list_params list_params['list_action'] = (redirects.getPublicRedirect, list_params) - return self.list(request, access_type=access_type, page_name=page_name, - params=list_params, filter=filter, **kwargs) + valid_list = lists.getListContent( + request, list_params, filter, idx=0) + + ip_params = list_params.copy() # ineligible proposals + + description = ugettext('List of my ineligible/withdrawn %s.') % ( + ip_params['name_plural']) + + ip_params['list_description'] = description + ip_params['list_action'] = (redirects.getPublicRedirect, ip_params) + + filter = {'scope' : student_entity, + 'status': 'invalid'} + + ip_list = lists.getListContent( + request, ip_params, filter, idx=1, need_content=True) + + contents = [] + # fill contents with all the needed lists + contents.append(valid_list) + + if ip_list != None: + contents.append(ip_list) + + # call the _list method from base to display the list + return self._list(request, list_params, contents, page_name, context) @decorators.merge_params @decorators.check_access