Skip to content

Commit

Permalink
Adapted models and templates to support Uploadcare
Browse files Browse the repository at this point in the history
  • Loading branch information
Zowie committed Jul 13, 2017
1 parent 1403edf commit 7c57311
Show file tree
Hide file tree
Showing 20 changed files with 57 additions and 135 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.idea
*.log
*.pot
*.pyc
.project
.pydevproject
.settings
.*
djangocms_slideshow.egg-info
djangocms_slider_easy.egg-info
djangocms_slider_easy_uploadcare.egg-info
dist
build
env*
Expand Down
File renamed without changes.
Binary file added db.sqlite3
Binary file not shown.
1 change: 0 additions & 1 deletion djangocms_slider/__init__.py

This file was deleted.

39 changes: 0 additions & 39 deletions djangocms_slider/migrations/0001_initial.py

This file was deleted.

37 changes: 0 additions & 37 deletions djangocms_slider/migrations/0002_auto_20160728_1656.py

This file was deleted.

20 changes: 0 additions & 20 deletions djangocms_slider/migrations/0003_auto_20160728_1705.py

This file was deleted.

21 changes: 0 additions & 21 deletions djangocms_slider/migrations/0004_auto_20161108_2219.py

This file was deleted.

1 change: 1 addition & 0 deletions djangocms_slider_uploadcare/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.3.0'
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext_lazy as _
from .models import Slider, Slide
from .models import UploadcareSlide, UploadcareSlider


class SlidePlugin(CMSPluginBase):
model = Slide
class UploadcareSlidePlugin(CMSPluginBase):
model = UploadcareSlide
module = _("Slider")
name = _("Slide")
render_template = 'djangocms_slider/slide.html'

plugin_pool.register_plugin(SlidePlugin)
plugin_pool.register_plugin(UploadcareSlidePlugin)


class SliderPlugin(CMSPluginBase):
model = Slider
class UploadcareSliderPlugin(CMSPluginBase):
model = UploadcareSlider
name = _('Slider')
module = _("Slideshow")
render_template = 'djangocms_slider/slider.html'
allow_children = True
child_classes = ["SlidePlugin"]
child_classes = ["UploadcareSlidePlugin"]

def render(self, context, instance, placeholder):
context.update({
Expand All @@ -31,4 +31,4 @@ def render(self, context, instance, placeholder):
return context


plugin_pool.register_plugin(SliderPlugin)
plugin_pool.register_plugin(UploadcareSliderPlugin)
39 changes: 39 additions & 0 deletions djangocms_slider_uploadcare/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models
import pyuploadcare.dj.models


class Migration(migrations.Migration):

dependencies = [
('cms', '0016_auto_20160608_1535'),
]

operations = [
migrations.CreateModel(
name='UploadcareSlide',
fields=[
('cmsplugin_ptr', models.OneToOneField(primary_key=True, serialize=False, auto_created=True, related_name='djangocms_slider_uploadcare_uploadcareslide', parent_link=True, to='cms.CMSPlugin')),
('image', pyuploadcare.dj.models.ImageField()),
('url', models.CharField(verbose_name='link', max_length=255, blank=True, null=True, help_text='If present, clicking on image will take user to link.')),
('caption', models.TextField(verbose_name='caption', max_length=255, blank=True, null=True, help_text='Specifies text that occurs on the slide.')),
('page_link', models.ForeignKey(verbose_name='page', blank=True, null=True, help_text='If present, clicking on image will take user to specified page.', to='cms.Page')),
],
options={
'abstract': False,
},
bases=('cms.cmsplugin',),
),
migrations.CreateModel(
name='UploadcareSlider',
fields=[
('cmsplugin_ptr', models.OneToOneField(primary_key=True, serialize=False, auto_created=True, related_name='djangocms_slider_uploadcare_uploadcareslider', parent_link=True, to='cms.CMSPlugin')),
],
options={
'abstract': False,
},
bases=('cms.cmsplugin',),
),
]
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_plugin_media_path(instance, filename):


@python_2_unicode_compatible
class Slide(CMSPlugin):
class UploadcareSlide(CMSPlugin):
"""
A Slide plugin that contains an image and some text.
"""
Expand Down Expand Up @@ -57,7 +57,7 @@ def clean(self):


@python_2_unicode_compatible
class Slider(CMSPlugin):
class UploadcareSlider(CMSPlugin):
"""
Plugin that can contain Slides.
"""
Expand Down
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env python
import os

import djangocms_slider
import djangocms_slider_uploadcare

try:
from setuptools import setup
except ImportError:
from distutils.core import setup

version = djangocms_slider.__version__
version = djangocms_slider_uploadcare.__version__


def read(fname):
Expand Down Expand Up @@ -39,15 +39,15 @@ def read(fname):
]

setup(
name="djangocms-slider-easy",
name="djangocms-slider-easy-uploadcare",
version=version,
author="Luminum Solutions",
author_email="info@akoten.com",
author_email="zowie@akoten.com",
description="A slider plugin for djangocms that lets you arrange slides like any other djangocms plugin. Fork of urga/djangocms-slider, but using uploadcare.",
license="BSD",
keywords=["slideshow", "django", "cms", "plugin"],
url="https://github.com/Akoten/djangocms-slider-easy-uploadcare",
packages=['djangocms_slider', 'djangocms_slider.migrations'],
packages=['djangocms_slider_uploadcare', 'djangocms_slider_uploadcare.migrations'],
install_requires=INSTALL_REQUIRES,
classifiers=CLASSIFIERS,
long_description=read('README.md'),
Expand Down

0 comments on commit 7c57311

Please sign in to comment.