Add the discovery of proper
ThumbnailOption
model in you appmodels.py
Create a manual migration like in
example_migration.py
In every migration (even existing ones) add:
from custom_plugins.models import thumbnail_model
In every migration (even existing ones) replace
'cmsplugin_filer_image.ThumbnailOption'
withthumbnail_model
like here https://github.com/nephila/djangocms-blog/blob/develop/djangocms_blog/migrations/0001_initial.py#L12 -> https://github.com/nephila/djangocms-blog/blob/develop/djangocms_blog/migrations/0001_initial.py#L108
Last active
June 25, 2016 14:05
-
-
Save yakky/b86817691997b1817e76384cbeb3617f to your computer and use it in GitHub Desktop.
Migrate to filer ThumbnailOption
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# This migration must be created manually | |
from __future__ import unicode_literals | |
from django.db import migrations, models | |
from custom_plugins.models import thumbnail_model | |
class Migration(migrations.Migration): | |
if 'cmsplugin_filer' not in thumbnail_model: | |
dependencies = [ | |
('custom_plugins', 'PREVIOUS_MIGRATION'), | |
('filer', '0003_thumbnailoption'), | |
('cmsplugin_filer_image', '0003_mv_thumbnail_option_to_filer_20160119_1720'), | |
] | |
run_before = [ | |
('cmsplugin_filer_image', '0004_auto_20160120_0950'), | |
] | |
else: | |
dependencies = [ | |
('filer', '__first__'), | |
('cmsplugin_filer_image', '__first__'), | |
('custom_plugins', 'PREVIOUS_MIGRATION'), | |
] | |
operations = [ | |
migrations.AlterField( | |
model_name='MyModel', ## Add your model name | |
name='ThumbnailOptionField', ## Add your field name | |
field=models.ForeignKey(related_name='MyRelatedName', | |
verbose_name='Main image full', blank=True, | |
to=thumbnail_model, null=True), | |
), | |
... | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import foo | |
... | |
try: | |
from cmsplugin_filer_image.models import ThumbnailOption # NOQA | |
except ImportError: | |
from filer.models import ThumbnailOption # NOQA | |
thumbnail_model = '%s.%s' % ( | |
ThumbnailOption._meta.app_label, ThumbnailOption.__name__ | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment