Merge pull request #266 from nephila/feature/better_migratoins
Refactor migration dependencies to avoid issue when going backward
This commit is contained in:
commit
aa66465e4e
5 changed files with 22 additions and 19 deletions
|
@ -17,14 +17,23 @@ ACTUAL_FILER_IMAGE_MODEL = FILER_IMAGE_MODEL or 'filer.Image'
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
if 'cmsplugin_filer' not in thumbnail_model:
|
||||||
|
filer_dependencies = [
|
||||||
|
('filer', '0003_thumbnailoption'),
|
||||||
|
('cmsplugin_filer_image', '0006_auto_20160427_1438')
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
filer_dependencies = [
|
||||||
|
('filer', '__first__'),
|
||||||
|
('cmsplugin_filer_image', '__first__'),
|
||||||
|
]
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
migrations.swappable_dependency(ACTUAL_FILER_IMAGE_MODEL),
|
migrations.swappable_dependency(ACTUAL_FILER_IMAGE_MODEL),
|
||||||
('cms', '__latest__'),
|
('cms', '__first__'),
|
||||||
('taggit', '__latest__'),
|
('taggit', '__first__'),
|
||||||
('filer', '__latest__'),
|
] + filer_dependencies
|
||||||
('cmsplugin_filer_image', '__latest__'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
|
|
|
@ -7,7 +7,7 @@ from django.db import models, migrations
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('sites', '__latest__'),
|
('sites', '__first__'),
|
||||||
('djangocms_blog', '0001_initial'),
|
('djangocms_blog', '0001_initial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ def migrate_tags_reverse(apps, schema_editor):
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('taggit', '__latest__'),
|
('taggit', '__first__'),
|
||||||
('djangocms_blog', '0008_auto_20150814_0831'),
|
('djangocms_blog', '0008_auto_20150814_0831'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ from django.db import models, migrations
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('cms', '__latest__'),
|
('cms', '__first__'),
|
||||||
('djangocms_blog', '0009_latestpostsplugin_tags_new'),
|
('djangocms_blog', '0009_latestpostsplugin_tags_new'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -32,18 +32,12 @@ from .settings import get_setting
|
||||||
BLOG_CURRENT_POST_IDENTIFIER = get_setting('CURRENT_POST_IDENTIFIER')
|
BLOG_CURRENT_POST_IDENTIFIER = get_setting('CURRENT_POST_IDENTIFIER')
|
||||||
BLOG_CURRENT_NAMESPACE = get_setting('CURRENT_NAMESPACE')
|
BLOG_CURRENT_NAMESPACE = get_setting('CURRENT_NAMESPACE')
|
||||||
|
|
||||||
try:
|
try: # pragma: no cover
|
||||||
from cmsplugin_filer_image.models import ThumbnailOption # NOQA
|
|
||||||
except ImportError:
|
|
||||||
from filer.models import ThumbnailOption # NOQA
|
from filer.models import ThumbnailOption # NOQA
|
||||||
try:
|
thumbnail_model = 'filer.ThumbnailOption'
|
||||||
thumbnail_model = '%s.%s' % (
|
except ImportError: # pragma: no cover
|
||||||
ThumbnailOption._meta.app_label, ThumbnailOption._meta.model_name
|
from cmsplugin_filer_image.models import ThumbnailOption # NOQA
|
||||||
)
|
thumbnail_model = 'cmsplugin_filer_image.ThumbnailOption'
|
||||||
except AttributeError:
|
|
||||||
thumbnail_model = '%s.%s' % (
|
|
||||||
ThumbnailOption._meta.app_label, ThumbnailOption._meta.module_name
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue