blob: 4e3fffaa8c3d57d320a16323a6a255704f03cdd2 [file] [log] [blame]
# Copyright 2013 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Definitions of Melange types."""
from melange.models import organization
from melange.models import profile as ndb_profile
from melange.models import user
from soc.models import profile
from soc.models import program
from soc.models import timeline
class Models(object):
"""Class that encapsulates methods that return appropriate model classes.
Attributes:
ndb_org_model: class that represents organization model.
profile_model: class that represents profile model.
program_model: class that represents program model.
timeline_model: class that represents timeline model.
user_model: class that represents user model.
"""
def __init__(
self, profile_model=None, program_model=None, program_messages_model=None,
timeline_model=None):
"""Initializes new instance of Models class.
Args:
profile_model: class that represents profile model.
program_model: class that represents program model.
program_messages_model: class that represents program messages model.
timeline_model: class that represents timeline model.
"""
self.ndb_org_model = organization.Organization
self.ndb_profile_model = ndb_profile.Profile
self.profile_model = profile_model
self.program_model = program_model
self.program_messages_model = program_messages_model
self.timeline_model = timeline_model
self.user_model = user.User
MELANGE_MODELS = Models(
profile_model=profile.Profile,
program_model=program.Program,
program_messages_model=program.ProgramMessages,
timeline_model=timeline.Timeline)