How to use the wagtailmedia.models.AbstractMedia function in wagtailmedia

To help you get started, we’ve selected a few wagtailmedia examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github torchbox / wagtailmedia / wagtailmedia / models.py View on Github external
    @property
    def usage_url(self):
        return reverse('wagtailmedia:media_usage',
                       args=(self.id,))

    def is_editable_by_user(self, user):
        from wagtailmedia.permissions import permission_policy
        return permission_policy.user_has_permission_for_instance(user, 'change', self)

    class Meta:
        abstract = True
        verbose_name = _('media')


class Media(AbstractMedia):
    admin_form_fields = (
        'title',
        'file',
        'collection',
        'duration',
        'width',
        'height',
        'thumbnail',
        'tags',
    )


def get_media_model():
    from django.conf import settings
    from django.apps import apps
github praekeltfoundation / molo / molo / core / models.py View on Github external
ERROR,
                            "Failed to record content",
                            {
                                "foreign_page_id": foreign_id,
                                "exception": e,
                                "function": function.__name__,
                            })

        return page


class PreventDeleteMixin(object):
    hide_delete_button = True


class MoloMedia(AbstractMedia):
    youtube_link = models.CharField(max_length=512, null=True, blank=True)
    feature_in_homepage = models.BooleanField(default=False)

    admin_form_fields = (
        'title',
        'file',
        'collection',
        'duration',
        'width',
        'height',
        'thumbnail',
        'tags',
        'youtube_link',
        'feature_in_homepage',
    )