diff --git a/README.md b/README.md index 09a8e93..08d41bb 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,10 @@ This plugin requires `django CMS` 3.0 or higher to be properly installed. * In your projects `virtualenv`_, run ``pip install djangocms-video``. * Add ``'djangocms_video'`` to your ``INSTALLED_APPS`` setting. +* If using Django 1.7 add ``'djangocms_video': 'djangocms_video.migrations_django',`` + to ``MIGRATION_MODULES`` (or define ``MIGRATION_MODULES`` if it does not exists); + when django CMS 3.1 will be released, migrations for Django 1.7 will be moved + to the standard location and the south-style ones to ``south_migrations``. * Run ``manage.py migrate djangocms_video``. diff --git a/djangocms_video/migrations_django/0001_initial.py b/djangocms_video/migrations_django/0001_initial.py new file mode 100644 index 0000000..3602bf9 --- /dev/null +++ b/djangocms_video/migrations_django/0001_initial.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import cms.models.pluginmodel + + +class Migration(migrations.Migration): + + dependencies = [ + ('cms', '__first__'), + ] + + operations = [ + migrations.CreateModel( + name='Video', + fields=[ + ('movie', models.FileField(help_text='use .flv file or h264 encoded video file', upload_to=cms.models.pluginmodel.get_plugin_media_path, null=True, verbose_name='movie file', blank=True)), + ('movie_url', models.CharField(help_text='vimeo or youtube video url. Example: http://www.youtube.com/watch?v=-iJ7bs4mTUY', max_length=255, null=True, verbose_name='movie url', blank=True)), + ('image', models.ImageField(help_text='preview image file', upload_to=cms.models.pluginmodel.get_plugin_media_path, null=True, verbose_name='image', blank=True)), + ('width', models.PositiveSmallIntegerField(verbose_name='width')), + ('height', models.PositiveSmallIntegerField(verbose_name='height')), + ('auto_play', models.BooleanField(default=False, verbose_name='auto play')), + ('auto_hide', models.BooleanField(default=False, verbose_name='auto hide')), + ('fullscreen', models.BooleanField(default=True, verbose_name='fullscreen')), + ('loop', models.BooleanField(default=False, verbose_name='loop')), + ('bgcolor', models.CharField(default=b'000000', help_text='Hexadecimal, eg ff00cc', max_length=6, verbose_name='background color')), + ('textcolor', models.CharField(default=b'FFFFFF', help_text='Hexadecimal, eg ff00cc', max_length=6, verbose_name='text color')), + ('seekbarcolor', models.CharField(default=b'13ABEC', help_text='Hexadecimal, eg ff00cc', max_length=6, verbose_name='seekbar color')), + ('seekbarbgcolor', models.CharField(default=b'333333', help_text='Hexadecimal, eg ff00cc', max_length=6, verbose_name='seekbar bg color')), + ('loadingbarcolor', models.CharField(default=b'828282', help_text='Hexadecimal, eg ff00cc', max_length=6, verbose_name='loadingbar color')), + ('buttonoutcolor', models.CharField(default=b'333333', help_text='Hexadecimal, eg ff00cc', max_length=6, verbose_name='button out color')), + ('buttonovercolor', models.CharField(default=b'000000', help_text='Hexadecimal, eg ff00cc', max_length=6, verbose_name='button over color')), + ('buttonhighlightcolor', models.CharField(default=b'FFFFFF', help_text='Hexadecimal, eg ff00cc', max_length=6, verbose_name='button highlight color')), + ('cmsplugin_ptr', models.OneToOneField(auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ], + options={ + 'abstract': False, + }, + bases=('cms.cmsplugin',), + ), + ] diff --git a/djangocms_video/migrations_django/__init__.py b/djangocms_video/migrations_django/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/djangocms_video/models.py b/djangocms_video/models.py index a80753c..2c2965c 100644 --- a/djangocms_video/models.py +++ b/djangocms_video/models.py @@ -3,8 +3,16 @@ import os from django.db import models from django.utils.translation import ugettext_lazy as _ -from cms.utils.compat.dj import python_2_unicode_compatible from cms.models import CMSPlugin +try: + from cms.models import get_plugin_media_path +except ImportError: + def get_plugin_media_path(instance, filename): + """ + See cms.models.pluginmodel.get_plugin_media_path on django CMS 3.0.4+ for information + """ + return instance.get_media_path(filename) +from cms.utils.compat.dj import python_2_unicode_compatible from . import settings @@ -13,7 +21,7 @@ from . import settings class Video(CMSPlugin): # player settings movie = models.FileField( - _('movie file'), upload_to=CMSPlugin.get_media_path, + _('movie file'), upload_to=get_plugin_media_path, help_text=_('use .flv file or h264 encoded video file'), blank=True, null=True) @@ -24,7 +32,7 @@ class Video(CMSPlugin): blank=True, null=True) image = models.ImageField( - _('image'), upload_to=CMSPlugin.get_media_path, + _('image'), upload_to=get_plugin_media_path, help_text=_('preview image file'), null=True, blank=True) width = models.PositiveSmallIntegerField(_('width'))