}

    class Meta(object):
        app_label = 'metadata'

    @classmethod
    def make_foreign_key(cls, nullable=False):
        return models.ForeignKey(
            cls,
            blank=nullable,
            null=nullable,
        )

MetadataSubjectTestTextMetadata = TextMetadata.make_model(
    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',
示例#2
0
        blank=True,
        related_name='led_groups_set',
        help_text="""An optional link to a role who is considered to
            represent the "leader" of the group, if any.  For
            example, if there is a Computing Team, the Head of
            Computing role would be the group leader.

            """)

RoleTextMetadata = TextMetadata.make_model(
    Role,
    'lass_lerouge',
    'RoleTextMetadata',
    getattr(
        settings, 'ROLE_TEXT_METADATA_DB_TABLE',
        None
    ),
    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
示例#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)
)