# HG changeset patch # User Lennard de Rijk # Date 1232578042 0 # Node ID c3cdb581ffd25be466ad7de83d2448e9bddb294a # Parent 3d40190f35b68a16b3a36df4898eefa5d3ab9167 Replaced boolean properties in soc/models/group_app with status property. This property has 5 choices ['accepted','rejected','ignored','needs review','completed'] Patch by: Lennard de Rijk Reviewed by: to-be-reviewed diff -r 3d40190f35b6 -r c3cdb581ffd2 app/soc/logic/models/club.py --- a/app/soc/logic/models/club.py Wed Jan 21 22:21:40 2009 +0000 +++ b/app/soc/logic/models/club.py Wed Jan 21 22:47:22 2009 +0000 @@ -65,7 +65,7 @@ request_logic.logic.updateOrCreateFromFields(properties, key_fields) # set the application to completed - fields = {'application_completed' : True} + fields = {'status' : 'completed'} club_app_logic.logic.updateModelProperties(application, fields) diff -r 3d40190f35b6 -r c3cdb581ffd2 app/soc/models/group_app.py --- a/app/soc/models/group_app.py Wed Jan 21 22:21:40 2009 +0000 +++ b/app/soc/models/group_app.py Wed Jan 21 22:47:22 2009 +0000 @@ -96,20 +96,14 @@ ' Please be as specific as possible.')) member_criteria.help_text = ugettext_lazy( 'Members include mentors, admininstrators, and the like.') - - # boolean to indicate if an application has been reviewed - reviewed = db.BooleanProperty(required=True, default=False, - verbose_name=ugettext_lazy('Has been reviewed') - ) - # boolean to indicate if an application has been accepted - accepted = db.BooleanProperty(required=True, default=False, - verbose_name=ugettext_lazy('Has been accepted') - ) - - # boolean to indicate that this application has been - # handled and turned into a group - application_completed = db.BooleanProperty(required=True, default=False, - verbose_name=ugettext_lazy('Has been completed')) + + # property containing the status of the application + # completed means that the application has been processed into a real group + status = db.StringProperty(required=True, + choices=['accepted','rejected','ignored','needs review','completed'], + default='needs review', + verbose_name=ugettext_lazy('Application Status')) + # timestamp to record the time on which this application has been created created_on = db.DateTimeProperty(required=True, auto_now_add=True, diff -r 3d40190f35b6 -r c3cdb581ffd2 app/soc/templates/soc/club_app/review.html --- a/app/soc/templates/soc/club_app/review.html Wed Jan 21 22:21:40 2009 +0000 +++ b/app/soc/templates/soc/club_app/review.html Wed Jan 21 22:47:22 2009 +0000 @@ -31,9 +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.reviewed.label entity.reviewed %} - {% readonly_field_as_table_row entity.fields.accepted.label entity.accepted %} - {% readonly_field_as_table_row entity.fields.application_completed.label entity.application_completed %} + {% readonly_field_as_table_row entity.fields.status.label entity.status %} {% readonly_field_as_table_row "Created on" entity.created_on %} {% readonly_field_as_table_row "Last Modified on" entity.last_modified_on %} @@ -41,8 +39,9 @@ - - + + + diff -r 3d40190f35b6 -r c3cdb581ffd2 app/soc/views/helper/access.py --- a/app/soc/views/helper/access.py Wed Jan 21 22:21:40 2009 +0000 +++ b/app/soc/views/helper/access.py Wed Jan 21 22:47:22 2009 +0000 @@ -399,9 +399,7 @@ properties = { 'applicant': user, - 'reviewed': True, - 'accepted': True, - 'application_completed': False, + 'status': 'accepted' } application = app_logic.logic.getForFields(properties, unique=True) diff -r 3d40190f35b6 -r c3cdb581ffd2 app/soc/views/models/club_app.py --- a/app/soc/views/models/club_app.py Wed Jan 21 22:21:40 2009 +0000 +++ b/app/soc/views/models/club_app.py Wed Jan 21 22:47:22 2009 +0000 @@ -71,8 +71,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', - 'reviewed', 'accepted', 'application_completed', + new_params['extra_dynaexclude'] = ['applicant', 'backup_admin', 'status', 'created_on', 'last_modified_on'] new_params['create_extra_dynafields'] = { 'backup_admin_link_id': forms.CharField( @@ -121,8 +120,7 @@ is_developer = accounts.isDeveloper(user=user_entity) filter = { - 'application_completed': False, - 'reviewed': False, + 'status': 'needs review', } if not is_developer: @@ -146,8 +144,7 @@ # Get all the reviewed applications now # Re-use the old filter, but set to only reviewed and accepted - filter['reviewed'] = True - filter['accepted'] = True + filter['status'] = 'accepted' aa_params = params.copy() # accepted applications @@ -164,10 +161,10 @@ aa_list = list_helper.getListContent( request, aa_params, filter, 1) - # Get all the reviewd applications that were denied + # Get all the reviewed applications that were denied # Re use the old filter, but this time only for denied apps - filter['accepted'] = False + filter['status'] = 'rejected' da_params = params.copy() # denied applications @@ -203,9 +200,8 @@ fields['applicant'] = user_logic.logic.getForCurrentAccount() # the application has either been created or edited so - # the review status needs to be set accordingly - fields['reviewed'] = False - fields['accepted'] = False + # the status needs to be set accordingly + fields['status'] = 'needs review' def _public(self, request, entity, context): """See base._public(). @@ -241,24 +237,13 @@ get_dict = request.GET # check to see if we can make a decision for this application - if 'accepted' in get_dict.keys(): - accepted_value = get_dict['accepted'] - - fields = {'reviewed' : False} + if 'status' in get_dict.keys(): + status_value = get_dict['status'] - if accepted_value == 'true': - # the application has been accepted - fields['accepted'] = True - fields['reviewed'] = True - notifications.sendNewClubNotification(entity) - elif accepted_value == 'false': - # the application has been denied - fields['accepted'] = False - fields['reviewed'] = True + if status_value in ['accepted', 'rejected', 'ignored']: + # this application has been properly reviewed update the status + fields = {'status' : status_value} - if fields['reviewed']: - # the application has either been denied or accepted - # mark it as reviewed and update accordingly application = self._logic.getFromFields(link_id=kwargs['link_id']) self._logic.updateModelProperties(application, fields) @@ -283,7 +268,7 @@ params = dicts.merge(params, self._params) # only select the requests that haven't been reviewed yet - filter = {'reviewed' : False} + filter = {'status' : 'needs review'} ur_params = params.copy() ur_params['list_description'] = ugettext_lazy('A list of all unhandled ' @@ -294,8 +279,7 @@ request, ur_params, filter, 0) # only select the requests that haven't been turned into a group yet - filter = {'accepted' : True, - 'application_completed' : False} + filter['status'] = 'accepted' uh_params = params.copy() uh_params['list_description'] = ugettext_lazy('A list of all applications ' @@ -306,8 +290,7 @@ request, uh_params, filter, 0) #only select the requests the have been denied - filter = {'reviewed' : True, - 'accepted' : False} + filter ['status'] = 'rejected' den_params = params.copy() den_params['list_description'] = ugettext_lazy('A list of all applications '