app/soc/models/mentor.py
author Lennard de Rijk <ljvderijk@gmail.com>
Thu, 13 Aug 2009 14:02:22 -0700
changeset 2770 71a5a56cf29e
parent 2588 db306bbda381
permissions -rw-r--r--
Redone the acceptedStudentsExport functionality. The method has been renamed to exportStudentsWithProjects and retrieves the document_name and the new shipping address properties. Also it filters out all invalid projects or projects for wich the scope_path doesn't match the given scope_pa th_start. Also there is no more need to use the argument given to this method when adding the extra columns. The data is now prepared by one loop which uses the key present in the accepted_students dictionary for retrieving the data used by the extra columns.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     2
#
1308
35b75ffcbb37 Partially reverted "Update the copyright notice for 2009."
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1307
diff changeset
     3
# Copyright 2008 the Melange authors.
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     4
#
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     8
# 
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    10
# 
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    15
# limitations under the License.
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    16
1113
78e4ea7e71f9 Small changes in Mentor model (we don't inherit from Reviewer anymore since model inheritance is not supported in datastore).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    17
"""This module contains the Organization Mentor Model."""
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    18
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    19
__authors__ = [
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    20
  '"Todd Larsen" <tlarsen@google.com>',
1989
3fa3384b5378 Added a 'Can we contact you' property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1387
diff changeset
    21
  '"Sverre Rabbelier" <sverre@rabbelier.nl>',
1387
857e6cc8ebc1 Added required program property to org_admin and mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1308
diff changeset
    22
  '"Lennard de Rijk" <ljdverijk@gmail.com>',
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    23
]
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    24
1387
857e6cc8ebc1 Added required program property to org_admin and mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1308
diff changeset
    25
from google.appengine.ext import db
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    26
1989
3fa3384b5378 Added a 'Can we contact you' property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1387
diff changeset
    27
from django.utils.translation import ugettext
3fa3384b5378 Added a 'Can we contact you' property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1387
diff changeset
    28
1387
857e6cc8ebc1 Added required program property to org_admin and mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1308
diff changeset
    29
import soc.models.program
1113
78e4ea7e71f9 Small changes in Mentor model (we don't inherit from Reviewer anymore since model inheritance is not supported in datastore).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    30
import soc.models.role
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    31
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    32
1113
78e4ea7e71f9 Small changes in Mentor model (we don't inherit from Reviewer anymore since model inheritance is not supported in datastore).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    33
class Mentor(soc.models.role.Role):
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    34
  """Organization Mentor.
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    35
  """
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    36
1387
857e6cc8ebc1 Added required program property to org_admin and mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1308
diff changeset
    37
  #: A required property that defines the program that this mentor works for
857e6cc8ebc1 Added required program property to org_admin and mentor.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1308
diff changeset
    38
  program = db.ReferenceProperty(reference_class=soc.models.program.Program,
2588
db306bbda381 Indention fixes and adding "reference_class=" in ReferenceProperty params.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1989
diff changeset
    39
                                 required=True, collection_name='mentors')
1989
3fa3384b5378 Added a 'Can we contact you' property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1387
diff changeset
    40
3fa3384b5378 Added a 'Can we contact you' property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1387
diff changeset
    41
  can_we_contact_you = db.BooleanProperty(verbose_name=ugettext(
3fa3384b5378 Added a 'Can we contact you' property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1387
diff changeset
    42
      'Can we contact you?'))
3fa3384b5378 Added a 'Can we contact you' property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1387
diff changeset
    43
  can_we_contact_you.help_text = ugettext(
3fa3384b5378 Added a 'Can we contact you' property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1387
diff changeset
    44
      'Please check here if you would not mind being contacted by the Program'
3fa3384b5378 Added a 'Can we contact you' property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1387
diff changeset
    45
      ' Administrators for follow up with members of the press who would like'
3fa3384b5378 Added a 'Can we contact you' property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1387
diff changeset
    46
      ' to interview you about the program.')
3fa3384b5378 Added a 'Can we contact you' property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1387
diff changeset
    47
  can_we_contact_you.group = ugettext("2. Contact Info (Private)")