blob: 77a46866e6e627824c6148a1fed1e073f7ccb50e [file] [log] [blame]
# Copyright 2014 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 slot transfer related models."""
from google.appengine.ext import ndb
from google.appengine.ext.ndb import msgprop
from protorpc import messages
class Status(messages.Enum):
"""Class that enumerates possible statuses of slot transfer requests."""
#: The slot transfer request has been submitted to the program administrators.
PENDING = 1
#: The slot transfer request has been accepted by the program administrators.
ACCEPTED = 2
#: The slot transfer request has been rejected by the program administrators.
REJECTED = 3
class SlotTransfer(ndb.Model):
"""Model that represents an action of giving up allocated slots back to
the pool by the organization has decided to give up.
Parent:
melange.models.organization.Organization
"""
#: The number of slots the organization has decided to give back
quantity = ndb.IntegerProperty(required=True)
#: Field storing status of the slot transfer request.
status = msgprop.EnumProperty(Status, required=True, default=Status.PENDING)
#: Field storing optional message to program administrators which is
#: sent along with the request.
org_message = ndb.TextProperty()
#: The program to which this slot transfer request belongs.
program = ndb.KeyProperty(required=True)
#: Field storing the date when the proposal was initially created.
created_on = ndb.DateTimeProperty(required=True, auto_now_add=True)