From 9a51e617b1d5611f1398d40a409abad971616c57 Mon Sep 17 00:00:00 2001 From: eXeCUT Date: Fri, 13 Nov 2020 22:42:26 +0300 Subject: [PATCH 1/3] #1 added new django compatibility --- cmsplugin_gridloading/migrations/0001_initial.py | 10 +++++----- cmsplugin_gridloading/models.py | 4 ++-- cmsplugin_gridloading/utils.py | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmsplugin_gridloading/migrations/0001_initial.py b/cmsplugin_gridloading/migrations/0001_initial.py index ae89d3f..6010b2c 100644 --- a/cmsplugin_gridloading/migrations/0001_initial.py +++ b/cmsplugin_gridloading/migrations/0001_initial.py @@ -19,8 +19,8 @@ class Migration(migrations.Migration): migrations.CreateModel( name='GridloadingItemFolderPlugin', fields=[ - ('cmsplugin_ptr', models.OneToOneField(related_name='cmsplugin_gridloading_gridloadingitemfolderplugin', to='cms.CMSPlugin', auto_created=True, primary_key=True, serialize=False, parent_link=True)), - ('folder', filer.fields.folder.FilerFolderField(help_text='Show all the image(s) include in the selected folder.', to='filer.Folder', verbose_name='Folder')), + ('cmsplugin_ptr', models.OneToOneField(related_name='cmsplugin_gridloading_gridloadingitemfolderplugin', to='cms.CMSPlugin', auto_created=True, primary_key=True, serialize=False, parent_link=True, on_delete=models.CASCADE)), + ('folder', filer.fields.folder.FilerFolderField(help_text='Show all the image(s) include in the selected folder.', to='filer.Folder', verbose_name='Folder', on_delete=models.CASCADE)), ], options={ 'abstract': False, @@ -30,11 +30,11 @@ class Migration(migrations.Migration): migrations.CreateModel( name='GridloadingItemPlugin', fields=[ - ('cmsplugin_ptr', models.OneToOneField(related_name='cmsplugin_gridloading_gridloadingitemplugin', to='cms.CMSPlugin', auto_created=True, primary_key=True, serialize=False, parent_link=True)), + ('cmsplugin_ptr', models.OneToOneField(related_name='cmsplugin_gridloading_gridloadingitemplugin', to='cms.CMSPlugin', auto_created=True, primary_key=True, serialize=False, parent_link=True, on_delete=models.CASCADE)), ('content', djangocms_text_ckeditor.fields.HTMLField(default='', verbose_name='Content', blank=True)), ('link_url', models.URLField(null=True, verbose_name='Link', blank=True)), ('link_target', models.CharField(verbose_name='Target', max_length=100, blank=True, choices=[('_blank', 'Open in new window'), ('_self', 'Open in same window'), ('_parent', 'Delegate to parent'), ('_top', 'Delegate to top')])), - ('image', filer.fields.image.FilerImageField(to='filer.Image', null=True, verbose_name='Image', blank=True)), + ('image', filer.fields.image.FilerImageField(to='filer.Image', null=True, verbose_name='Image', blank=True, on_delete=models.CASCADE)), ('link_page', cms.models.fields.PageField(help_text='A link to a page has priority over a text link.', to='cms.Page', null=True, verbose_name='Page', blank=True)), ], options={ @@ -45,7 +45,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='GridloadingPlugin', fields=[ - ('cmsplugin_ptr', models.OneToOneField(related_name='cmsplugin_gridloading_gridloadingplugin', to='cms.CMSPlugin', auto_created=True, primary_key=True, serialize=False, parent_link=True)), + ('cmsplugin_ptr', models.OneToOneField(related_name='cmsplugin_gridloading_gridloadingplugin', to='cms.CMSPlugin', auto_created=True, primary_key=True, serialize=False, parent_link=True, on_delete=models.CASCADE)), ('effect', models.CharField(default='opacity', max_length=255, verbose_name='Loading effect', choices=[('opacity', 'Opacity'), ('move-up', 'Move Up'), ('scale-up', 'Scale Up'), ('fall-perspective', 'Fall Perspective'), ('fly', 'Fly'), ('flip', 'Flip'), ('helix', 'Helix'), ('pop-up', 'Pop Up')])), ('aspect_ratio', models.CharField(help_text='Determines width and height of the image according to the selected ratio. All images will be with same size. Not select ratio to maintain portrait/landscape of image.', default='', choices=[('1x1', '1x1'), ('4x3', '4x3'), ('16x9', '16x9'), ('16x10', '16x10'), ('21x9', '21x9'), ('3x4', '3x4'), ('9x16', '9x16'), ('10x16', '10x16'), ('9x21', '9x21')], verbose_name='Aspect ratio', blank=True, max_length=255)), ('extra_styles', models.CharField(help_text='An arbitrary string of CSS classes to add', verbose_name='Extra styles', blank=True, max_length=50)), diff --git a/cmsplugin_gridloading/models.py b/cmsplugin_gridloading/models.py index 57f382e..e87fed1 100644 --- a/cmsplugin_gridloading/models.py +++ b/cmsplugin_gridloading/models.py @@ -100,7 +100,7 @@ class GridloadingItemPlugin(CMSPlugin): """ Gridloading: "Item" Model """ - image = FilerImageField(verbose_name=_('Image'), blank=True, null=True) + image = FilerImageField(verbose_name=_('Image'), blank=True, null=True, on_delete=models.CASCADE) content = HTMLField(verbose_name=_('Content'), blank=True, default='') link_url = models.URLField(_("Link"), blank=True, null=True) link_page = PageField( @@ -153,7 +153,7 @@ class GridloadingItemFolderPlugin(CMSPlugin): #cmsplugin_ptr = CMSPluginField() folder = FilerFolderField(verbose_name=_('Folder'), \ - help_text=_('Show all the image(s) include in the selected folder.')) + help_text=_('Show all the image(s) include in the selected folder.'), on_delete=models.CASCADE) def __str__(self): if self.folder_id: diff --git a/cmsplugin_gridloading/utils.py b/cmsplugin_gridloading/utils.py index 1566694..c2327a1 100644 --- a/cmsplugin_gridloading/utils.py +++ b/cmsplugin_gridloading/utils.py @@ -8,9 +8,9 @@ def get_additional_effects(): choices = [] raw = getattr(settings, 'GRIDLOADING_EFFECTS', False) if raw: - if isinstance(raw, basestring): + if isinstance(raw, str): raw = raw.split(',') for choice in raw: - clean = choice.strip() + clean = str(choice).strip() choices.append((clean.lower(), clean.title())) return choices From 52e03218aa612a524e11cc61a980de95b38c6460 Mon Sep 17 00:00:00 2001 From: eXeCUT Date: Fri, 13 Nov 2020 22:59:34 +0300 Subject: [PATCH 2/3] changed deprecated staticfiles tags --- .../templates/cmsplugin_gridloading/plugins/base.html | 2 +- .../templates/cmsplugin_gridloading/plugins/item.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmsplugin_gridloading/templates/cmsplugin_gridloading/plugins/base.html b/cmsplugin_gridloading/templates/cmsplugin_gridloading/plugins/base.html index 08c1e4d..35a3e2e 100644 --- a/cmsplugin_gridloading/templates/cmsplugin_gridloading/plugins/base.html +++ b/cmsplugin_gridloading/templates/cmsplugin_gridloading/plugins/base.html @@ -1,4 +1,4 @@ -{% load cms_tags shuffle sekizai_tags staticfiles %} +{% load cms_tags shuffle sekizai_tags static %}