diff --git a/addons/djangocms-video/addon.json b/addons/djangocms-video/addon.json new file mode 100644 index 0000000..29850bf --- /dev/null +++ b/addons/djangocms-video/addon.json @@ -0,0 +1,6 @@ +{ + "installed-apps": [ + "djangocms_video" + ], + "package-name": "djangocms-video" +} \ No newline at end of file diff --git a/addons/djangocms-video/aldryn_config.py b/addons/djangocms-video/aldryn_config.py new file mode 100644 index 0000000..7cbc95c --- /dev/null +++ b/addons/djangocms-video/aldryn_config.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +from aldryn_client import forms + + +def split_and_strip(string): + return [item.strip() for item in string.split(',') if item] + + +class Form(forms.BaseForm): + templates = forms.CharField( + 'List of additional templates (comma separated)', + required=False, + ) + extensions = forms.CharField( + 'List of allowed extensions, default "mp4, webm, ogv" when empty (comma separated)', + required=False, + ) + + def clean(self): + data = super(Form, self).clean() + + # older versions of this addon had a bug where the values would be + # saved to settings.json as a list instead of a string. + if isinstance(data['templates'], list): + data['templates'] = ', '.join(data['templates']) + if isinstance(data['extensions'], list): + data['extensions'] = ', '.join(data['extensions']) + + # prettify + data['templates'] = ', '.join(split_and_strip(data['templates'])) + data['extensions'] = ', '.join(split_and_strip(data['extensions'])) + return data + + def to_settings(self, data, settings): + if data['templates']: + settings['DJANGOCMS_VIDEO_TEMPLATES'] = [ + (item, item) + for item in split_and_strip(data['templates']) + ] + if data['extensions']: + settings['DJANGOCMS_VIDEO_ALLOWED_EXTENSIONS'] = split_and_strip(data['extensions']) + + return settings diff --git a/addons/djangocms-video/settings.json b/addons/djangocms-video/settings.json new file mode 100644 index 0000000..ffddf99 --- /dev/null +++ b/addons/djangocms-video/settings.json @@ -0,0 +1,4 @@ +{ + "extensions": null, + "templates": null +} \ No newline at end of file diff --git a/requirements.in b/requirements.in index ad5fa15..b440911 100644 --- a/requirements.in +++ b/requirements.in @@ -8,5 +8,6 @@ https://control.divio.com/api/v1/apps/serve/djangocms-link/2.1.2/35b986c1-fafb-4 https://control.divio.com/api/v1/apps/serve/djangocms-picture/2.0.6/005e8663-d1cc-4667-936c-30709edad076/djangocms-picture-2.0.6.tar.gz#egg=djangocms-picture==2.0.6 https://control.divio.com/api/v1/apps/serve/djangocms-snippet/2.0.0/03734ae6-5d3e-44aa-8641-8f764dbced64/djangocms-snippet-2.0.0.tar.gz#egg=djangocms-snippet==2.0.0 https://control.divio.com/api/v1/apps/serve/djangocms-text-ckeditor/3.5.3/a7b5179f-cea5-4af8-b235-6b7f709c4e6a/djangocms-text-ckeditor-3.5.3.tar.gz#egg=djangocms-text-ckeditor==3.5.3 +https://control.divio.com/api/v1/apps/serve/djangocms-video/2.0.4/d62adbd2-40e9-4cc5-9a10-01a5e141bf85/djangocms-video-2.0.4.tar.gz#egg=djangocms-video==2.0.4 https://control.divio.com/api/v1/apps/serve/django-filer/1.3.0.1/bcb7d25b-6922-48a9-a252-9bc165f6403e/django-filer-1.3.0.1.tar.gz#egg=django-filer==1.3.0.1 # diff --git a/settings.py b/settings.py index f087d98..83b62ba 100644 --- a/settings.py +++ b/settings.py @@ -11,6 +11,7 @@ INSTALLED_ADDONS = [ 'djangocms-picture', 'djangocms-snippet', 'djangocms-text-ckeditor', + 'djangocms-video', 'django-filer', # ]