app/soc/logic/models/organization.py
author Lennard de Rijk <ljvderijk@gmail.com>
Wed, 21 Jan 2009 19:32:00 +0000
changeset 882 267e31f1a0b6
parent 682 187f4d95fedb
child 1115 0a723ff3d27c
permissions -rw-r--r--
Added club_app model and logic. Patch by: Lennard de Rijk
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
682
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     2
#
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
#
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
#
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
#
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    17
"""Organization (Model) query functions.
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    18
"""
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
__authors__ = [
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    21
  '"Sverre Rabbelier" <sverre@rabbelier.nl>',
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    22
  ]
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
from soc.logic.models import base
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    26
from soc.logic.models import group
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    27
from soc.logic.models import program as program_logic
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    28
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    29
import soc.models.group
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    30
import soc.models.organization
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    31
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    32
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    33
class Logic(group.Logic):
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    34
  """Logic methods for the Organization model.
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    35
  """
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    36
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    37
  def __init__(self, model=soc.models.organization.Organization,
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    38
               base_model=soc.models.group.Group, scope_logic=program_logic):
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    39
    """Defines the name, key_name and model for this entity.
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    40
    """
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    41
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    42
    super(Logic, self).__init__(model=model, base_model=base_model,
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    43
                                scope_logic=scope_logic)
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    44
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    45
  # Restore base.Logic key field related methods
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    46
  getKeyValues = base.Logic.getKeyValues
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    47
  getKeyValuesFromFields = base.Logic.getKeyValuesFromFields
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    48
  getKeyFieldNames = base.Logic.getKeyFieldNames
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    49
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    50
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    51
logic = Logic()