Changed status in group app model to state.
authorLennard de Rijk <ljvderijk@gmail.com>
Fri, 30 Jan 2009 11:15:26 +0000
changeset 1080 d533408811ba
parent 1079 be1aacb33b0f
child 1081 81cf69225a24
Changed status in group app model to state. Also changed it wherever needed to increase consistency. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed
app/soc/logic/models/club.py
app/soc/models/group_app.py
app/soc/templates/soc/club_app/review.html
app/soc/templates/soc/request/process_invite.html
app/soc/templates/soc/request/process_request.html
app/soc/views/helper/access.py
app/soc/views/models/club_app.py
app/soc/views/models/request.py
app/soc/views/models/role.py
--- a/app/soc/logic/models/club.py	Fri Jan 30 10:36:23 2009 +0000
+++ b/app/soc/logic/models/club.py	Fri Jan 30 11:15:26 2009 +0000
@@ -66,7 +66,7 @@
         request_logic.logic.updateOrCreateFromFields(properties, key_fields)
 
       # set the application to completed  
-      fields = {'status' : 'completed'}
+      fields = {'state' : 'completed'}
       club_app_logic.logic.updateEntityProperties(application, fields)
 
     super(Logic, self)._onCreate(entity)
--- a/app/soc/models/group_app.py	Fri Jan 30 10:36:23 2009 +0000
+++ b/app/soc/models/group_app.py	Fri Jan 30 11:15:26 2009 +0000
@@ -98,9 +98,9 @@
   member_criteria.help_text = ugettext(
     'Members include mentors, admininstrators, and the like.')
 
-  # property containing the status of the application
+  # property containing the state of the application
   # completed means that the application has been processed into a real group
-  status = db.StringProperty(required=True, 
+  state = db.StringProperty(required=True, 
       choices=['accepted','rejected','ignored','needs review','completed'],
       default='needs review',
       verbose_name=ugettext('Application Status'))
--- a/app/soc/templates/soc/club_app/review.html	Fri Jan 30 10:36:23 2009 +0000
+++ b/app/soc/templates/soc/club_app/review.html	Fri Jan 30 11:15:26 2009 +0000
@@ -31,7 +31,7 @@
   {% readonly_field_as_twoline_table_row entity.fields.irc_channel.label entity.irc_channel %}
   {% readonly_field_as_twoline_table_row entity.fields.backup_admin.label entity.backup_admin.link_id %}
   {% readonly_field_as_twoline_table_row entity.fields.member_criteria.label entity.member_criteria %}
-  {% readonly_field_as_table_row entity.fields.status.label entity.status %}
+  {% readonly_field_as_table_row entity.fields.state.label entity.state %}
   {% readonly_field_as_table_row "Created on" entity.created_on %}
   {% readonly_field_as_table_row "Last Modified on" entity.last_modified_on %}
  </table>
@@ -39,9 +39,9 @@
 
 <tr>
   <td>
-    <input type="button" onclick="location.href='/{{ entity_type_url|lower }}/review/{{ entity.link_id }}?status=accepted'" value="Accept"/>
-    <input type="button" onclick="location.href='/{{ entity_type_url|lower }}/review/{{ entity.link_id }}?status=rejected'" value="Reject"/>
-    <input type="button" onclick="location.href='/{{ entity_type_url|lower }}/review/{{ entity.link_id }}?status=ignored'" value="Ignore"/>
+    <input type="button" onclick="location.href='/{{ entity_type_url|lower }}/review/{{ entity.link_id }}?state=accepted'" value="Accept"/>
+    <input type="button" onclick="location.href='/{{ entity_type_url|lower }}/review/{{ entity.link_id }}?state=rejected'" value="Reject"/>
+    <input type="button" onclick="location.href='/{{ entity_type_url|lower }}/review/{{ entity.link_id }}?state=ignored'" value="Ignore"/>
     <input type="button" onclick="location.href='/{{ entity_type_url|lower }}/delete/{{ entity.link_id }}'" value="Delete"/>
   </td>
 </tr>
--- a/app/soc/templates/soc/request/process_invite.html	Fri Jan 30 10:36:23 2009 +0000
+++ b/app/soc/templates/soc/request/process_invite.html	Fri Jan 30 11:15:26 2009 +0000
@@ -29,7 +29,7 @@
 <tr>
   <td>
     <input type="button" onclick="location.href='{{ invite_accepted_redirect }}'" value="Accept"/>
-    <input type="button" onclick="location.href='/{{ module_name }}/process_invite/{{ entity.scope_path }}/{{ entity.role }}/{{ entity.link_id }}?status=rejected'" value="Reject"/>
+    <input type="button" onclick="location.href='/{{ module_name }}/process_invite/{{ entity.scope_path }}/{{ entity.role }}/{{ entity.link_id }}?state=rejected'" value="Reject"/>
   </td>
 </tr>
 </table>
--- a/app/soc/templates/soc/request/process_request.html	Fri Jan 30 10:36:23 2009 +0000
+++ b/app/soc/templates/soc/request/process_request.html	Fri Jan 30 11:15:26 2009 +0000
@@ -28,9 +28,9 @@
 
 <tr>
   <td>
-    <input type="button" onclick="location.href='/{{ module_name }}/process_request/{{ entity.scope_path }}/{{ entity.link_id }}?status=group_accepted'" value="Accept"/>
-    <input type="button" onclick="location.href='/{{ module_name }}/process_request/{{ entity.scope_path }}/{{ entity.link_id }}?status=rejected'" value="Reject"/>
-    <input type="button" onclick="location.href='/{{ module_name }}/process_request/{{ entity.scope_path }}/{{ entity.link_id }}?status=ignored'" value="Ignore"/>
+    <input type="button" onclick="location.href='/{{ module_name }}/process_request/{{ entity.scope_path }}/{{ entity.link_id }}?state=group_accepted'" value="Accept"/>
+    <input type="button" onclick="location.href='/{{ module_name }}/process_request/{{ entity.scope_path }}/{{ entity.link_id }}?state=rejected'" value="Reject"/>
+    <input type="button" onclick="location.href='/{{ module_name }}/process_request/{{ entity.scope_path }}/{{ entity.link_id }}?state=ignored'" value="Ignore"/>
   </td>
 </tr>
 </table>
--- a/app/soc/views/helper/access.py	Fri Jan 30 10:36:23 2009 +0000
+++ b/app/soc/views/helper/access.py	Fri Jan 30 11:15:26 2009 +0000
@@ -708,7 +708,7 @@
 
     properties = {
         'applicant': user,
-        'status': 'accepted'
+        'state': 'accepted'
         }
 
     application = app_logic.logic.getForFields(properties, unique=True)
--- a/app/soc/views/models/club_app.py	Fri Jan 30 10:36:23 2009 +0000
+++ b/app/soc/views/models/club_app.py	Fri Jan 30 11:15:26 2009 +0000
@@ -73,7 +73,7 @@
     new_params['create_template'] = 'soc/models/twoline_edit.html'
     new_params['edit_template'] = 'soc/models/twoline_edit.html'
 
-    new_params['extra_dynaexclude'] = ['applicant', 'backup_admin', 'status',
+    new_params['extra_dynaexclude'] = ['applicant', 'backup_admin', 'state',
         'created_on', 'last_modified_on']
     new_params['create_extra_dynafields'] = {
         'backup_admin_link_id': forms.CharField(
@@ -83,6 +83,10 @@
             cleaning.clean_users_not_same('backup_admin_link_id'),
         }
 
+    new_params['edit_extra_dynafields'] = {
+        'clean_link_id' : cleaning.clean_link_id('link_id'),
+        }
+
     patterns = [(r'^%(url_name)s/(?P<access_type>review)$',
         'soc.views.models.%(module_name)s.review_overview',
         'Review %(name_plural)s'),
@@ -122,7 +126,7 @@
     is_developer = accounts.isDeveloper(user=user_entity)
 
     filter = {
-        'status': 'needs review',
+        'state': 'needs review',
         }
 
     if not is_developer:
@@ -146,7 +150,7 @@
     # get all the reviewed applications now
 
     # re-use the old filter, but set to only reviewed and accepted
-    filter['status'] = 'accepted'
+    filter['state'] = 'accepted'
 
     aa_params = params.copy() # accepted applications
 
@@ -166,7 +170,7 @@
     # get all the reviewed applications that were denied
 
     # re use the old filter, but this time only for denied apps
-    filter['status'] = 'rejected'
+    filter['state'] = 'rejected'
 
     da_params = params.copy() # denied applications
 
@@ -184,7 +188,7 @@
 
     if is_developer:
       # re use the old filter, but this time only for ignored apps
-      filter['status'] = 'ignored'
+      filter['state'] = 'ignored'
 
       ia_params = params.copy() # ignored applications
 
@@ -217,8 +221,8 @@
       fields['applicant'] = user_logic.logic.getForCurrentAccount()
 
     # the application has either been created or edited so
-    # the status needs to be set accordingly
-    fields['status'] = 'needs review'
+    # the state needs to be set accordingly
+    fields['state'] = 'needs review'
 
   def _public(self, request, entity, context):
     """See base._public().
@@ -254,16 +258,16 @@
     get_dict = request.GET
 
     # check to see if we can make a decision for this application
-    if 'status' in get_dict.keys():
-      status_value = get_dict['status']
+    if 'state' in get_dict.keys():
+      state_value = get_dict['state']
 
-      if status_value in ['accepted', 'rejected', 'ignored']:
-        # this application has been properly reviewed update the status
-        fields = {'status' : status_value}
+      if state_value in ['accepted', 'rejected', 'ignored']:
+        # this application has been properly reviewed update the state
+        fields = {'state' : state_value}
 
         self._logic.updateEntityProperties(entity, fields)
         
-        if status_value == 'accepted':
+        if state_value == 'accepted':
           # the application has been accepted send out a notification
           notifications.sendNewClubNotification(entity)
 
@@ -288,7 +292,7 @@
     params = dicts.merge(params, self._params)
 
     # only select the requests that haven't been reviewed yet
-    filter = {'status' : 'needs review'}
+    filter = {'state' : 'needs review'}
 
     ur_params = params.copy()
     ur_params['list_description'] = ugettext('A list of all unhandled '
@@ -299,7 +303,7 @@
         request, ur_params, filter, 0)
 
     # only select the requests that haven't been turned into a group yet
-    filter['status'] = 'accepted'
+    filter['state'] = 'accepted'
 
     uh_params = params.copy()
     uh_params['list_description'] = ugettext('A list of all applications '
@@ -310,7 +314,7 @@
         request, uh_params, filter, 1)
 
     # only select the requests the have been rejected
-    filter ['status'] = 'rejected'
+    filter ['state'] = 'rejected'
 
     den_params = params.copy()
     den_params['list_description'] = ugettext('A list of all applications '
@@ -321,7 +325,7 @@
         request, den_params, filter, 2)
 
     # only select the request that have been ignored
-    filter ['status'] = 'ignored'
+    filter ['state'] = 'ignored'
 
     ign_params = params.copy()
     ign_params['list_description'] = ugettext('A list of all applications '
@@ -337,6 +341,7 @@
     # call the _list method from base to display the list
     return self._list(request, params, contents, page_name)
 
+
 view = View()
 
 create = view.create
--- a/app/soc/views/models/request.py	Fri Jan 30 10:36:23 2009 +0000
+++ b/app/soc/views/models/request.py	Fri Jan 30 11:15:26 2009 +0000
@@ -160,8 +160,8 @@
 
     get_dict = request.GET
     
-    if 'status' in get_dict.keys():
-      if get_dict['status'] == 'rejected':
+    if 'state' in get_dict.keys():
+      if get_dict['state'] == 'rejected':
         # this invite has been rejected mark as rejected
         request_logic.updateEntityProperties(request_entity, {
             'state': 'rejected'})
--- a/app/soc/views/models/role.py	Fri Jan 30 10:36:23 2009 +0000
+++ b/app/soc/views/models/role.py	Fri Jan 30 11:15:26 2009 +0000
@@ -510,12 +510,12 @@
     
     get_dict = request.GET
     
-    if 'status' in get_dict.keys():
-      if get_dict['status'] in ['group_accepted', 'rejected', 'ignored']:
+    if 'state' in get_dict.keys():
+      if get_dict['state'] in ['group_accepted', 'rejected', 'ignored']:
         # update the request_entity and redirect away from this page
-        request_state = get_dict['status']
+        request_state = get_dict['state']
         request_logic.logic.updateEntityProperties(request_entity, {
-            'state': get_dict['status']})
+            'state': get_dict['state']})
 
         if request_state == 'group_accepted':
           notifications_helper.sendInviteNotification(request_entity)