Пример #1
0
    MetadataSubjectTest,
    'metadata',
    fkey=MetadataSubjectTest.make_foreign_key(nullable=True)
)

MetadataSubjectTestPackageEntry = PackageEntry.make_model(
    MetadataSubjectTest,
    'metadata',
    fkey=MetadataSubjectTest.make_foreign_key(nullable=True)
)

# See if overriding as much as possible works
TestImageMetadata = ImageMetadata.make_model(
    MetadataSubjectTest,
    'metadata',
    model_name='TestImageMetadata',
    table='frobnik',
    id_column='foobles',
    fkey=MetadataSubjectTest.make_foreign_key(nullable=True),
)


class PackageTest(TestCase):
    """
    Tests to see if the metadata packages system is hooked in
    correctly and used as a fallback metadata source.

    """
    fixtures = ['test_people', 'metadata_test', 'package_test']

    def test_text(self):
        """
Пример #2
0
    ),
    getattr(
        settings, 'ROLE_TEXT_METADATA_DB_ID_COLUMN',
        None
    ),
    fkey=Role.make_foreign_key(),
)


RoleImageMetadata = ImageMetadata.make_model(
    Role,
    'lass_lerouge',
    'RoleImageMetadata',
    getattr(
        settings, 'ROLE_IMAGE_METADATA_DB_TABLE',
        None
    ),
    getattr(
        settings, 'ROLE_IMAGE_METADATA_DB_ID_COLUMN',
        None
    ),
    fkey=Role.make_foreign_key(),
)


class RoleInheritance(models.Model):
    """A parent-child inheritance relationship between roles.

    The role inheritance system causes children to inherit their
    privileges from parents, as well as making children of group
    roots become identified as part of the group (team) the group
    root defines.
Пример #3
0

# Automagic metadata models #

PodcastPackageEntry = PackageEntry.make_model(
    Podcast,
    'uryplayer',
    'PodcastPackageEntry',
    getattr(settings, 'PODCAST_PACKAGE_ENTRY_DB_TABLE', None),
    getattr(settings, 'PODCAST_PACKAGE_ENTRY_DB_ID_COLUMN', None),
    fkey=Podcast.make_foreign_key()
)

PodcastTextMetadata = TextMetadata.make_model(
    Podcast,
    'uryplayer',
    'PodcastTextMetadata',
    getattr(settings, 'PODCAST_TEXT_METADATA_DB_TABLE', None),
    getattr(settings, 'PODCAST_TEXT_METADATA_DB_ID_COLUMN', None),
    fkey=Podcast.make_foreign_key(nullable=True)
)

PodcastImageMetadata = ImageMetadata.make_model(
    Podcast,
    'uryplayer',
    'PodcastImageMetadata',
    getattr(settings, 'PODCAST_IMAGE_METADATA_DB_TABLE', None),
    getattr(settings, 'PODCAST_IMAGE_METADATA_DB_ID_COLUMN', None),
    fkey=Podcast.make_foreign_key(nullable=True)
)