Support Django 1.7 migrations
This commit is contained in:
parent
240e91860b
commit
440ada74fa
|
@ -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``.
|
||||
|
||||
|
||||
|
|
|
@ -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',),
|
||||
),
|
||||
]
|
|
@ -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'))
|
||||
|
|
Loading…
Reference in New Issue