예제 #1
0
    def test_settings(self):
        self.assertEqual(get_extensions(), ['mp4', 'webm', 'ogv'])
        settings.DJANGOCMS_VIDEO_ALLOWED_EXTENSIONS = ['mp4', 'flv']
        self.assertEqual(get_extensions(), ['mp4', 'flv'])

        self.assertEqual(get_templates(), [('default', 'Default')])
        settings.DJANGOCMS_VIDEO_TEMPLATES = [('feature', 'Feature')]
        self.assertEqual(get_templates(), [('default', 'Default'), ('feature', 'Feature')])
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.functional import cached_property
from django.utils.translation import ugettext, ugettext_lazy as _

from cms.models import CMSPlugin

from djangocms_attributes_field.fields import AttributesField
from djangocms_video.models import VideoTrack, get_extensions, get_templates

from djangocms_versioning_filer.fields import (
    FileGrouperField,
    ImageGrouperField,
)

ALLOWED_EXTENSIONS = get_extensions()


class VersionedVideoPlayer(CMSPlugin):
    template = models.CharField(
        verbose_name=_('Template'),
        choices=get_templates(),
        default=get_templates()[0][0],
        max_length=255,
    )
    label = models.CharField(
        verbose_name=_('Label'),
        blank=True,
        max_length=255,
    )
    embed_link = models.CharField(