Org admins can mark a StudentProposal as invalid if they for any reason find it ineligible.
authorLennard de Rijk <ljvderijk@gmail.com>
Mon, 09 Mar 2009 20:43:46 +0000
changeset 1779 cdd11aa8dbc7
parent 1778 660502cad63a
child 1780 210ab3d5d6ea
Org admins can mark a StudentProposal as invalid if they for any reason find it ineligible. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed
app/soc/models/student_proposal.py
app/soc/templates/soc/student_proposal/review.html
app/soc/views/models/student_proposal.py
--- a/app/soc/models/student_proposal.py	Mon Mar 09 19:37:56 2009 +0000
+++ b/app/soc/models/student_proposal.py	Mon Mar 09 20:43:46 2009 +0000
@@ -80,9 +80,8 @@
   #: new : the proposal has not been ranked/scored yet
   #: pending: the proposal is in the process of being ranked/scored
   #: accepted: the proposal has been assigned a project slot
-  #: rejected: the proposal has not been assigned a slot or the organization
-  #: does not want this proposal.
-  #: invalid: the student or developer marked this as an invalid proposal.
+  #: rejected: the proposal has not been assigned a slot
+  #: invalid: the student or org admin marked this as an invalid proposal.
   status = db.StringProperty(required=True, default='new',
       choices=['new', 'pending', 'accepted', 'rejected', 'invalid'])
 
--- a/app/soc/templates/soc/student_proposal/review.html	Mon Mar 09 19:37:56 2009 +0000
+++ b/app/soc/templates/soc/student_proposal/review.html	Mon Mar 09 20:43:46 2009 +0000
@@ -71,6 +71,12 @@
      </td>
      {% endif %}
    {% endif %}
+   {% if is_org_admin %}
+     <td>
+       <input style="font-weight: bold" type="button" value="Mark as Ineligible"
+       onclick="location.href='?ineligible=1'"/>
+     </td>
+   {% endif %}
  </table>
 </form>
 
--- a/app/soc/views/models/student_proposal.py	Mon Mar 09 19:37:56 2009 +0000
+++ b/app/soc/views/models/student_proposal.py	Mon Mar 09 20:43:46 2009 +0000
@@ -533,6 +533,16 @@
     if mentor_entity and choice:
       self._adjustPossibleMentors(entity, mentor_entity, choice)
 
+    is_ineligible = request.GET.get('ineligible')
+    if org_admin_entity and is_ineligible:
+      # mark the proposal invalid and return to the list
+      properties = {'status': 'invalid'}
+      self._logic.updateEntityProperties(entity, properties)
+
+      redirect = redirects.getListProposalsRedirect(entity.org,
+                                                    {'url_name': 'org'})
+      return http.HttpResponseRedirect(redirect)
+
     # decide which form to use
     if org_admin_entity:
       form = params['admin_review_form']
@@ -692,6 +702,9 @@
         # show "I am willing to mentor"
         context['add_me_as_mentor'] = True
 
+    if org_admin:
+      context['is_org_admin'] = True
+
     return context
 
   def _adjustPossibleMentors(self, entity, mentor, choice):