app/soc/models/request.py
changeset 495 87afae6e4c51
child 533 ba3309b2fd30
equal deleted inserted replaced
494:5e9c656a1b68 495:87afae6e4c51
       
     1 #!/usr/bin/python2.5
       
     2 #
       
     3 # Copyright 2008 the Melange authors.
       
     4 #
       
     5 # Licensed under the Apache License, Version 2.0 (the "License");
       
     6 # you may not use this file except in compliance with the License.
       
     7 # You may obtain a copy of the License at
       
     8 #
       
     9 #   http://www.apache.org/licenses/LICENSE-2.0
       
    10 #
       
    11 # Unless required by applicable law or agreed to in writing, software
       
    12 # distributed under the License is distributed on an "AS IS" BASIS,
       
    13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    14 # See the License for the specific language governing permissions and
       
    15 # limitations under the License.
       
    16 
       
    17 """This module contains the Request Model."""
       
    18 
       
    19 __authors__ = [
       
    20   '"Sverre Rabbelier" <sverre@rabbelier.nl>',
       
    21 ]
       
    22 
       
    23 
       
    24 import polymodel
       
    25 
       
    26 from google.appengine.ext import db
       
    27 
       
    28 from django.utils.translation import ugettext_lazy
       
    29 
       
    30 import soc.models.user
       
    31 import soc.models.group
       
    32 
       
    33 
       
    34 class Request(polymodel.PolyModel):
       
    35   """A request is made to allow a person to create a new Role entity.
       
    36   """
       
    37 
       
    38   requester = db.ReferenceProperty(reference_class=soc.models.user.User,
       
    39                               required=True, collection_name="requests")
       
    40   requester.help_text = ugettext_lazy(
       
    41       'This is the user who the request is made for')
       
    42 
       
    43   role = db.StringProperty()
       
    44   role.help_text = ugettext_lazy(
       
    45       'This should be the type of the role that is requested')
       
    46 
       
    47   to = db.ReferenceProperty(reference_class=soc.models.group.Group,
       
    48                             required=True, collection_name="requests")
       
    49   to.help_text = ugettext_lazy(
       
    50       'The group that the request should be made to '
       
    51       '(this group should have the authority to grant the request)')
       
    52 
       
    53   accepted = db.BooleanProperty()
       
    54   accepted.help_text = ugettext_lazy(
       
    55       'Field used to indicate whether a request has been accepted')
       
    56 
       
    57   declined = db.BooleanProperty()
       
    58   declined.help_text = ugettext_lazy(
       
    59       'Field used to indicate that a request has been rejected by the user')