app/soc/models/club.py
author Todd Larsen <tlarsen@google.com>
Wed, 24 Sep 2008 05:17:44 +0000
changeset 197 4cf7c0040f2e
parent 181 fdd29818a954
child 208 e076aee6e90f
permissions -rw-r--r--
Sidebar-building controller, with a TODO remaining to implement marking the current page as "selected".
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
172
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     2
#
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     4
#
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     8
#
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    10
#
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    15
# limitations under the License.
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    16
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    17
"""This module contains the Club Model."""
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    18
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    19
__authors__ = [
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    20
  '"Todd Larsen" <tlarsen@google.com>',
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    21
]
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    22
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    23
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    24
from google.appengine.ext import db
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    25
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    26
from soc.models import base
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    27
import soc.models.group
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    28
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    29
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    30
class Club(base.ModelWithFieldAttributes):
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    31
  """Details specific to a Club.
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    32
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    33
  A Club is a generic type of Group that gathers Members into a community.
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    34
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    35
  A Club entity participates in the following relationships implemented
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    36
  as a db.ReferenceProperty elsewhere in another db.Model:
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    37
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    38
   members)  a 1:many relationship of Members belonging to a Club.  This
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    39
     relation is implemented as the 'members' back-reference Query of the
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    40
     Member model 'club' reference.
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    41
  """
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    42
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    43
  #: Required 1:1 relationship that ties Club details to the more generic
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    44
  #: Group details.  The back-reference in the Group model is a Query
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    45
  #: named 'club'.
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    46
  group = db.ReferenceProperty(reference_class=soc.models.org.Group,
594e07154872 First pass (from some old code notes) of a Club Model (a form of Group).
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    47
                               required=True, collection_name="club")