app/soc/models/program.py
author Lennard de Rijk <ljvderijk@gmail.com>
Wed, 07 Jan 2009 16:49:16 +0000
changeset 771 0b1beae179f5
parent 769 a0ee643fe832
child 849 c193ac0ef593
permissions -rw-r--r--
Typo and style fixes. Patch by: Pawel Solyga and Lennard de Rijk
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
643
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     2
#
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
#
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
#
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
#
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
771
0b1beae179f5 Typo and style fixes.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 769
diff changeset
    17
"""This module contains the Program Model.
0b1beae179f5 Typo and style fixes.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 769
diff changeset
    18
"""
643
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
__authors__ = [
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    21
  '"Sverre Rabbelier" <sverre@rabbelier.nl>',
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    22
]
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
649
95a41542e693 Finish Program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    25
from google.appengine.ext import db
95a41542e693 Finish Program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    26
643
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    27
from django.utils.translation import ugettext_lazy
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    28
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    29
import soc.models.presence
766
046b4b51eabf Made Program reference Timeline
Sverre Rabbelier <srabbelier@gmail.com>
parents: 740
diff changeset
    30
import soc.models.timeline
643
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    31
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    32
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    33
class Program(soc.models.presence.Presence):
667
f96095df1433 Some more import sorting fixes and docstring typos in program modules and soc.views.helper.redirects module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 649
diff changeset
    34
  """The Program model, representing a Program ran by a Sponsor.
643
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    35
  """
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    36
649
95a41542e693 Finish Program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    37
  #: Required field storing name of the group.
95a41542e693 Finish Program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    38
  name = db.StringProperty(required=True,
95a41542e693 Finish Program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    39
      verbose_name=ugettext_lazy('Name'))
95a41542e693 Finish Program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    40
  name.help_text = ugettext_lazy('Complete, formal name of the program.')
740
caa143c799a7 Added some example_text to program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 688
diff changeset
    41
  name.example_text = ugettext_lazy('Google Summer of Code 2009')
649
95a41542e693 Finish Program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    42
95a41542e693 Finish Program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    43
  #: Required field storing short name of the group.
95a41542e693 Finish Program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    44
  #: It can be used for displaying group as sidebar menu item.
95a41542e693 Finish Program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    45
  short_name = db.StringProperty(required=True,
95a41542e693 Finish Program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    46
      verbose_name=ugettext_lazy('Short name'))
95a41542e693 Finish Program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    47
  short_name.help_text = ugettext_lazy('Short name used for sidebar menu')
740
caa143c799a7 Added some example_text to program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 688
diff changeset
    48
  short_name.example_text = ugettext_lazy('GSoC 2009')
649
95a41542e693 Finish Program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    49
688
125cad9596da Changed generic_name to group_label in models/program.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 667
diff changeset
    50
  #: Optional field used to relate it to other programs
125cad9596da Changed generic_name to group_label in models/program.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 667
diff changeset
    51
  #: For example, GSoC would be a group label for GSoC2008/GSoC2009
125cad9596da Changed generic_name to group_label in models/program.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 667
diff changeset
    52
  group_label = db.StringProperty(
125cad9596da Changed generic_name to group_label in models/program.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 667
diff changeset
    53
      verbose_name=ugettext_lazy('Group label'))
125cad9596da Changed generic_name to group_label in models/program.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 667
diff changeset
    54
  group_label.help_text = ugettext_lazy(
740
caa143c799a7 Added some example_text to program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 688
diff changeset
    55
      'Optional name used to relate this program to others.')
caa143c799a7 Added some example_text to program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 688
diff changeset
    56
  group_label.example_text = ugettext_lazy('GSoC')
649
95a41542e693 Finish Program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    57
95a41542e693 Finish Program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    58
  #: Required field storing description of the group.
95a41542e693 Finish Program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    59
  description = db.TextProperty(required=True,
95a41542e693 Finish Program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    60
      verbose_name=ugettext_lazy('Description'))
740
caa143c799a7 Added some example_text to program
Sverre Rabbelier <srabbelier@gmail.com>
parents: 688
diff changeset
    61
  description.example_text = ugettext_lazy('This is the program for GSoC 2009')
769
a0ee643fe832 Added an elementary workflow choosing method to program creation.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 766
diff changeset
    62
  
a0ee643fe832 Added an elementary workflow choosing method to program creation.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 766
diff changeset
    63
  #: Required field storing the type of workflow this program has
a0ee643fe832 Added an elementary workflow choosing method to program creation.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 766
diff changeset
    64
  workflow = db.StringProperty(required=True,
a0ee643fe832 Added an elementary workflow choosing method to program creation.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 766
diff changeset
    65
      choices=['gsoc', 'ghop'],
771
0b1beae179f5 Typo and style fixes.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 769
diff changeset
    66
      verbose_name= ugettext_lazy('Workflow type'))
0b1beae179f5 Typo and style fixes.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 769
diff changeset
    67
  workflow.example_text = ugettext_lazy('Project-based for GSoC workflow type, ' 
0b1beae179f5 Typo and style fixes.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 769
diff changeset
    68
      'task-based for GHOP workflow type')
766
046b4b51eabf Made Program reference Timeline
Sverre Rabbelier <srabbelier@gmail.com>
parents: 740
diff changeset
    69
046b4b51eabf Made Program reference Timeline
Sverre Rabbelier <srabbelier@gmail.com>
parents: 740
diff changeset
    70
  #: Required 1:1 relationship indicating the Program the Timeline
046b4b51eabf Made Program reference Timeline
Sverre Rabbelier <srabbelier@gmail.com>
parents: 740
diff changeset
    71
  #: belongs to.
046b4b51eabf Made Program reference Timeline
Sverre Rabbelier <srabbelier@gmail.com>
parents: 740
diff changeset
    72
  timeline = db.ReferenceProperty(reference_class=soc.models.timeline.Timeline,
046b4b51eabf Made Program reference Timeline
Sverre Rabbelier <srabbelier@gmail.com>
parents: 740
diff changeset
    73
                                 required=True, collection_name="program",
046b4b51eabf Made Program reference Timeline
Sverre Rabbelier <srabbelier@gmail.com>
parents: 740
diff changeset
    74
                                 verbose_name=ugettext_lazy('Timeline'))