Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python2.5
- #
- # Copyright 2009 the Melange authors.
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- ''' This module contains the object used to represent invitations and
- requests between a user and an organization
- '''
- from google.appengine.ext import db
- import soc.modules.gsoc.models.organization
- import soc.modules.gsoc.models.profile
- class GSoCConnection(db.Model):
- """ GSoCConnection model.
- This model is intended to be used to represent either an invitation or
- request between a User and an Organization. The various states of this
- connection (see choices field below) represent the actions taken by each
- party in response to a request or invitation. A request/invite will result
- in the promotion of a User if and only if the state of the connection
- (the user_action or org_action) is 'accepted', or both actions are of the
- same type of acceptance.
- """
- # 'Supported' states for mentor invitations/requests and org admin invites
- choices = ['mentor_accepted', 'mentor_rejected', 'mentor_withdrawn',
- 'mentor_pending', 'org_admin_accepted', 'org_admin_rejected',
- 'org_admin_withdrawn', 'org_admin_pending', 'needs_info']
- organization = db.ReferenceProperty(organization.GSoCOrganization)
- user = db.ReferenceProperty(profile.GSoCProfile)
- user_action = db.StringProperty(choices=choices)
- org_action = db.StringProperty(choices=choices)
- def isMutualAction():
- return self.user_action == self.org_action
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement