Skip to content
This repository has been archived by the owner on Nov 27, 2019. It is now read-only.

Commit

Permalink
Improve thumbnailoption migrations (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky authored and mkoistinen committed Jun 22, 2016
1 parent 1db631b commit 47099c5
Showing 1 changed file with 7 additions and 3 deletions.
Expand Up @@ -16,13 +16,15 @@ def move_thumbnail_opt_to_filer(apps, schema_editor):
upscale=obj.upscale
)
except ThumbnailOptionNew.DoesNotExist:
ThumbnailOptionNew.objects.create(
th = ThumbnailOptionNew(
id=obj.id,
name=obj.name,
width=obj.width,
height=obj.height,
crop=obj.crop,
upscale=obj.upscale
)
)
th.save()

def move_thumbnail_opt_to_cms(apps, schema_editor):
ThumbnailOption = apps.get_model('filer', 'ThumbnailOption')
Expand All @@ -37,13 +39,15 @@ def move_thumbnail_opt_to_cms(apps, schema_editor):
upscale=obj.upscale
)
except ThumbnailOptionOld.DoesNotExist:
ThumbnailOptionOld.objects.create(
th = ThumbnailOptionNew(
id=obj.id,
name=obj.name,
width=obj.width,
height=obj.height,
crop=obj.crop,
upscale=obj.upscale
)
th.save()


class Migration(migrations.Migration):
Expand Down

0 comments on commit 47099c5

Please sign in to comment.