app/soc/logic/models/program.py
author Lennard de Rijk <ljvderijk@gmail.com>
Thu, 19 Mar 2009 08:30:06 +0000
changeset 1933 49aef36e0022
parent 1474 5eaf734fb178
child 2783 339696f3f5cf
permissions -rw-r--r--
Added StudentProject logic. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
611
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.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.
611
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
#
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
#
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
#
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
643
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents: 639
diff changeset
    17
"""Program (Model) query functions.
611
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    18
"""
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
__authors__ = [
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    21
  '"Sverre Rabbelier" <sverre@rabbelier.nl>',
769
a0ee643fe832 Added an elementary workflow choosing method to program creation.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 671
diff changeset
    22
  '"Lennard de Rijk" <ljvderijk@gmail.com>',
611
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
  ]
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
1053
3b9552cf748a Rename the confusing Tossed Model class to PresenceWithToS.
Todd Larsen <tlarsen@google.com>
parents: 1051
diff changeset
    26
from soc.logic.models import presence_with_tos
1474
5eaf734fb178 Set proper scope_logic for program and timeline
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1308
diff changeset
    27
from soc.logic.models import sponsor as sponsor_logic
620
e74e0b74625f Put the redirects in the views/helper/redirects.py module.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 611
diff changeset
    28
778
bc13cd968946 Added support for mutliple edit forms based on entity type
Sverre Rabbelier <srabbelier@gmail.com>
parents: 769
diff changeset
    29
import gsoc.logic.models.timeline
bc13cd968946 Added support for mutliple edit forms based on entity type
Sverre Rabbelier <srabbelier@gmail.com>
parents: 769
diff changeset
    30
import soc.logic.models.timeline
643
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents: 639
diff changeset
    31
import soc.models.program
620
e74e0b74625f Put the redirects in the views/helper/redirects.py module.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 611
diff changeset
    32
e74e0b74625f Put the redirects in the views/helper/redirects.py module.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 611
diff changeset
    33
1053
3b9552cf748a Rename the confusing Tossed Model class to PresenceWithToS.
Todd Larsen <tlarsen@google.com>
parents: 1051
diff changeset
    34
class Logic(presence_with_tos.Logic):
784
23eaf3aa19b1 Fix missing dots at the end of sentences in docstring and fix wrong import sorting in soc.logic.helper.notifications module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 778
diff changeset
    35
  """Logic methods for the Program model.
611
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    36
  """
2ec30182e5f1 Move parameter construction into a seperate module
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    37
778
bc13cd968946 Added support for mutliple edit forms based on entity type
Sverre Rabbelier <srabbelier@gmail.com>
parents: 769
diff changeset
    38
  TIMELINE_LOGIC = {'gsoc' : gsoc.logic.models.timeline.logic,
bc13cd968946 Added support for mutliple edit forms based on entity type
Sverre Rabbelier <srabbelier@gmail.com>
parents: 769
diff changeset
    39
                    'ghop' : soc.logic.models.timeline.logic}
bc13cd968946 Added support for mutliple edit forms based on entity type
Sverre Rabbelier <srabbelier@gmail.com>
parents: 769
diff changeset
    40
671
2c02178037ff Apply DI on the scope logic
Sverre Rabbelier <srabbelier@gmail.com>
parents: 667
diff changeset
    41
  def __init__(self, model=soc.models.program.Program, 
1474
5eaf734fb178 Set proper scope_logic for program and timeline
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1308
diff changeset
    42
               base_model=None, scope_logic=sponsor_logic):
643
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents: 639
diff changeset
    43
    """Defines the name, key_name and model for this entity.
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents: 639
diff changeset
    44
    """
655
9635cbaa2dcd Cleanups to the logic module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 643
diff changeset
    45
671
2c02178037ff Apply DI on the scope logic
Sverre Rabbelier <srabbelier@gmail.com>
parents: 667
diff changeset
    46
    super(Logic, self).__init__(model=model, base_model=base_model,
2c02178037ff Apply DI on the scope logic
Sverre Rabbelier <srabbelier@gmail.com>
parents: 667
diff changeset
    47
                                scope_logic=scope_logic)
620
e74e0b74625f Put the redirects in the views/helper/redirects.py module.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 611
diff changeset
    48
e74e0b74625f Put the redirects in the views/helper/redirects.py module.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 611
diff changeset
    49
643
b57d538a9dd3 Added programs
Sverre Rabbelier <srabbelier@gmail.com>
parents: 639
diff changeset
    50
logic = Logic()