1 # Generated by Django 3.0.6 on 2020-07-03 17:18
3 from django.db import migrations
7 def generate_versions(version_lists):
11 for subversion in generate_versions(version_lists[1:]):
12 for version in version_lists[0]:
13 yield [version] + subversion
16 def move_definitions(apps, schema_editor):
17 YouTube = apps.get_model('youtube', 'YouTube')
18 ThumbnailTemplate = apps.get_model('youtube', 'ThumbnailTemplate')
20 for youtube in YouTube.objects.all():
21 src_def = yaml.safe_load(youtube.thumbnail_definition)
24 for box in src_def['boxes']
26 for version in generate_versions(version_lists):
30 default_flow_style=False
32 ThumbnailTemplate.objects.create(
35 background=youtube.thumbnail_template,
41 class Migration(migrations.Migration):
44 ('youtube', '0011_thumbnailtemplate'),
50 migrations.RunPython.noop