Better strategy for ThumbnailOption detection

This commit is contained in:
Iacopo Spalletti 2016-05-29 00:55:49 +02:00
parent aa66465e4e
commit 3488464ef1
No known key found for this signature in database
GPG key ID: BDCBC2EB289F60C6
3 changed files with 17 additions and 8 deletions

View file

@ -10,7 +10,10 @@ class Migration(migrations.Migration):
if 'cmsplugin_filer' not in thumbnail_model: if 'cmsplugin_filer' not in thumbnail_model:
dependencies = [ dependencies = [
('djangocms_blog', '0016_auto_20160502_1741'), ('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: else:
dependencies = [ dependencies = [

View file

@ -33,11 +33,13 @@ BLOG_CURRENT_POST_IDENTIFIER = get_setting('CURRENT_POST_IDENTIFIER')
BLOG_CURRENT_NAMESPACE = get_setting('CURRENT_NAMESPACE') BLOG_CURRENT_NAMESPACE = get_setting('CURRENT_NAMESPACE')
try: # pragma: no cover 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 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: try:

View file

@ -9,15 +9,19 @@ from djangocms_blog.models import thumbnail_model
class Migration(SchemaMigration): class Migration(SchemaMigration):
if 'cmsplugin_filer' not in thumbnail_model: 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'), ('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: else:
dependencies = [ depends_on = [
('djangocms_blog', '0018_auto__chg_field_post_main_image_full__chg_field_post_main_image_thumbn'), ('djangocms_blog', '0018_auto__chg_field_post_main_image_full__chg_field_post_main_image_thumbn'),
] ]
def forwards(self, orm): def forwards(self, orm):
# Changing field 'Post.author' # Changing field 'Post.author'