Added pre-accpeted status to group_app.
authorLennard de Rijk <ljvderijk@gmail.com>
Fri, 06 Feb 2009 10:24:45 +0000
changeset 1232 3bce6205e24e
parent 1231 ab19a8ad375f
child 1233 fbe95d6b432e
Added pre-accpeted status to group_app. This can be used when we want to accept all org's at once. Instead of one by one. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed
app/soc/models/group_app.py
app/soc/templates/soc/org_app/review.html
app/soc/views/helper/access.py
app/soc/views/models/group_app.py
--- a/app/soc/models/group_app.py	Fri Feb 06 10:21:18 2009 +0000
+++ b/app/soc/models/group_app.py	Fri Feb 06 10:24:45 2009 +0000
@@ -99,8 +99,11 @@
 
   # property containing the status of the application
   # completed means that the application has been processed into a real group
+  # pre-accepted is used to indicate that the application has been accepted
+  # but the group cannot be made yet.
   status = db.StringProperty(required=True, 
-      choices=['accepted','rejected','ignored','needs review','completed'],
+      choices=['accepted','rejected','ignored','needs review','completed',
+          'pre-accepted'],
       default='needs review',
       verbose_name=ugettext('Application Status'))
 
--- a/app/soc/templates/soc/org_app/review.html	Fri Feb 06 10:21:18 2009 +0000
+++ b/app/soc/templates/soc/org_app/review.html	Fri Feb 06 10:24:45 2009 +0000
@@ -29,3 +29,14 @@
   {% readonly_field_as_twoline_table_row entity.fields.ideas.label entity.ideas %}
   {% readonly_field_as_twoline_table_row entity.fields.contrib_template.label entity.contrib_template %}
 {% endblock %}
+{% block buttons %}
+<tr>
+  <td>
+    <input type="button" onclick="location.href='/{{ entity_type_url|lower }}/review/{{ entity.key.name }}?status=pre-accepted'" value="Accept"/>
+    <input type="button" onclick="location.href='/{{ entity_type_url|lower }}/review/{{ entity.key.name }}?status=rejected'" value="Reject"/>
+    <input type="button" onclick="location.href='/{{ entity_type_url|lower }}/review/{{ entity.key.name }}?status=ignored'" value="Ignore"/>
+    <input type="button" onclick="location.href='/{{ entity_type_url|lower }}/delete/{{ entity.key.name }}'" value="Delete"/>
+  </td>
+</tr>
+</table>
+{% endblock buttons %}
--- a/app/soc/views/helper/access.py	Fri Feb 06 10:21:18 2009 +0000
+++ b/app/soc/views/helper/access.py	Fri Feb 06 10:24:45 2009 +0000
@@ -761,7 +761,8 @@
 
     fields = {
         'link_id': django_args['link_id'],
-        'status' : ['needs review', 'accepted', 'rejected', 'ignored']
+        'status' : ['needs review', 'accepted', 'rejected', 'ignored',
+            'pre-accepted']
         }
 
     if 'scope_path' in django_args:
--- a/app/soc/views/models/group_app.py	Fri Feb 06 10:21:18 2009 +0000
+++ b/app/soc/views/models/group_app.py	Fri Feb 06 10:24:45 2009 +0000
@@ -76,7 +76,7 @@
     new_params['extra_django_patterns'] = patterns
 
     new_params['sidebar_additional'] = [
-        ('/%(url_name)s/review' % params,
+        ('/%(url_name)s/review_overview' % params,
          'Review %(name_plural)s' % params, 'review_overview')]
 
     new_params['extra_dynaexclude'] = ['applicant', 'backup_admin', 'status',
@@ -190,6 +190,20 @@
     aa_list = list_helper.getListContent(
         request, aa_params, filter, 1)
 
+    if is_developer:
+      # re use the old filter, but this time only for pre-accepted apps
+      filter['status'] = 'pre-accepted'
+
+      pa_params = params.copy() # pre-accepted applications
+
+      pa_params['list_description'] = ugettext(
+          "An overview of all pre-accepted %(name_plural)s.") % params
+
+      pa_list = list_helper.getListContent(
+          request, pa_params, filter, 4)
+
+      contents += [pa_list]
+
     # get all the reviewed applications that were denied
 
     # re use the old filter, but this time only for denied apps
@@ -257,7 +271,7 @@
     if 'status' in get_dict.keys():
       status_value = get_dict['status']
 
-      if status_value in ['accepted', 'rejected', 'ignored']:
+      if status_value in ['accepted', 'rejected', 'ignored', 'pre-accepted']:
         # this application has been properly reviewed update the status
 
         # only update if the status changes
@@ -312,6 +326,17 @@
 
     uh_list = list_helper.getListContent(
         request, uh_params, filter, 1)
+    
+    # only select the requests that have been pre-accpeted
+    filter['status'] = 'pre-accepted'
+
+    pa_params = params.copy()
+    pa_params['list_description'] = ugettext(
+        "An overview of all pre-accepted %(name_plural)s.") % params
+    pa_params ['list_action'] = (redirects.getReviewRedirect, params)
+
+    pa_list = list_helper.getListContent(
+        request, pa_params, filter, 4)
 
     # only select the requests the have been rejected
     filter ['status'] = 'rejected'
@@ -336,7 +361,7 @@
         request, ign_params, filter, 3)
 
     # fill contents with all the needed lists
-    contents = [ur_list, uh_list, den_list, ign_list]
+    contents = [ur_list, uh_list, pa_list, den_list, ign_list]
 
     # call the _list method from base to display the list
     return self._list(request, params, contents, page_name)