Redirect to the manage page for failed, completed and withdrawn projects.
authorLennard de Rijk <ljvderijk@gmail.com>
Mon, 10 Aug 2009 15:49:47 -0700
changeset 2746 ca3b1a86bce8
parent 2745 c45dc8a5d64e
child 2747 915fe7338a72
Redirect to the manage page for failed, completed and withdrawn projects.
app/soc/views/models/student_project.py
--- a/app/soc/views/models/student_project.py	Mon Aug 10 15:37:12 2009 -0700
+++ b/app/soc/views/models/student_project.py	Mon Aug 10 15:49:47 2009 -0700
@@ -710,9 +710,9 @@
     # list all failed projects
     fields['status'] = 'failed'
     failed_params = list_params.copy()
-    failed_params['list_description'] = ('List of all failed %(name_plural)s, '
-        'these cannot be managed.') % list_params
-    failed_params['list_action'] = (redirects.getPublicRedirect, list_params)
+    failed_params['list_description'] = ('List of all %(name_plural)s who ' 
+                                         'failed the program.') % list_params
+    failed_params['list_action'] = (redirects.getManageRedirect, list_params)
 
     failed_list = lists.getListContent(
         request, failed_params, fields, idx=1, need_content=True)
@@ -723,10 +723,10 @@
     # list all completed projects
     fields['status'] = 'completed'
     completed_params = list_params.copy()
-    completed_params['list_description'] = ('List of %(name_plural)s that have '
-        'successfully completed the program, '
-        'these cannot be managed.' % list_params)
-    completed_params['list_action'] = (redirects.getPublicRedirect, list_params)
+    completed_params['list_description'] = (
+        'List of %(name_plural)s that have successfully completed the '
+        'program.' % list_params)
+    completed_params['list_action'] = (redirects.getManageRedirect, list_params)
 
     completed_list = lists.getListContent(
         request, completed_params, fields, idx=2, need_content=True)
@@ -734,6 +734,20 @@
     completed_list = list_info.setStudentProjectSurveyInfo(completed_list,
                                                            org_entity.scope)
 
+    # list all withdrawn projects
+    fields['status'] = 'withdrawn'
+    withdrawn_params = list_params.copy()
+    withdrawn_params['list_description'] = (
+        'List of %(name_plural)s that have withdrawn from the program.' %(
+            list_params))
+    withdrawn_params['list_action'] = (redirects.getManageRedirect, list_params)
+
+    withdrawn_list = lists.getListContent(
+        request, withdrawn_params, fields, idx=3, need_content=True)
+    # set the needed info
+    withdrawn_list = list_info.setStudentProjectSurveyInfo(withdrawn_list,
+                                                           org_entity.scope)
+
     # always show the list with active projects
     content = [active_list]
 
@@ -745,6 +759,10 @@
       # do not show empty completed list
       content.append(completed_list)
 
+    if withdrawn_list != None:
+      # do not show empty withdrawn list
+      content.append(withdrawn_list)
+
     # call the _list method from base to display the list
     return self._list(request, list_params, content,
                       context['page_name'], context)