From 3488464ef10e9b926349d5c909004db34b9da17b Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Sun, 29 May 2016 00:55:49 +0200 Subject: [PATCH] Better strategy for ThumbnailOption detection --- djangocms_blog/migrations/0017_thumbnail_move.py | 5 ++++- djangocms_blog/models.py | 10 ++++++---- ...uthor__chg_field_post_main_image_full__chg_field.py | 10 +++++++--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/djangocms_blog/migrations/0017_thumbnail_move.py b/djangocms_blog/migrations/0017_thumbnail_move.py index 1b1cb47..9aff3c7 100644 --- a/djangocms_blog/migrations/0017_thumbnail_move.py +++ b/djangocms_blog/migrations/0017_thumbnail_move.py @@ -10,7 +10,10 @@ class Migration(migrations.Migration): if 'cmsplugin_filer' not in thumbnail_model: dependencies = [ ('djangocms_blog', '0016_auto_20160502_1741'), - ('cmsplugin_filer_image', '0006_auto_20160427_1438') + ('cmsplugin_filer_image', '0003_mv_thumbnail_option_to_filer_20160119_1720'), + ] + run_before = [ + ('cmsplugin_filer_image', '0004_auto_20160120_0950'), ] else: dependencies = [ diff --git a/djangocms_blog/models.py b/djangocms_blog/models.py index 1a5874c..3a62aee 100644 --- a/djangocms_blog/models.py +++ b/djangocms_blog/models.py @@ -33,11 +33,13 @@ BLOG_CURRENT_POST_IDENTIFIER = get_setting('CURRENT_POST_IDENTIFIER') BLOG_CURRENT_NAMESPACE = get_setting('CURRENT_NAMESPACE') try: # pragma: no cover - from filer.models import ThumbnailOption # NOQA - thumbnail_model = 'filer.ThumbnailOption' -except ImportError: # pragma: no cover from cmsplugin_filer_image.models import ThumbnailOption # NOQA - thumbnail_model = 'cmsplugin_filer_image.ThumbnailOption' +except ImportError: # pragma: no cover + from filer.models import ThumbnailOption # NOQA + +thumbnail_model = '%s.%s' % ( + ThumbnailOption._meta.app_label, ThumbnailOption.__name__ +) try: diff --git a/djangocms_blog/south_migrations/0019_auto__chg_field_post_author__chg_field_post_main_image_full__chg_field.py b/djangocms_blog/south_migrations/0019_auto__chg_field_post_author__chg_field_post_main_image_full__chg_field.py index a2bea06..5ee2cb5 100644 --- a/djangocms_blog/south_migrations/0019_auto__chg_field_post_author__chg_field_post_main_image_full__chg_field.py +++ b/djangocms_blog/south_migrations/0019_auto__chg_field_post_author__chg_field_post_main_image_full__chg_field.py @@ -9,15 +9,19 @@ from djangocms_blog.models import thumbnail_model class Migration(SchemaMigration): if 'cmsplugin_filer' not in thumbnail_model: - dependencies = [ + depends_on = [ ('djangocms_blog', '0018_auto__chg_field_post_main_image_full__chg_field_post_main_image_thumbn'), - ('cmsplugin_filer_image', '0014_auto__del_thumbnailoption__chg_field_filerimage_thumbnail_option') + ('cmsplugin_filer_image', '0013_mv_thumbnailoption_to_filer'), + ] + needed_by = [ + ('cmsplugin_filer_image', '0014_auto__del_thumbnailoption__chg_field_filerimage_thumbnail_option'), ] else: - dependencies = [ + depends_on = [ ('djangocms_blog', '0018_auto__chg_field_post_main_image_full__chg_field_post_main_image_thumbn'), ] + def forwards(self, orm): # Changing field 'Post.author'