1 # Generated by Django 3.1.2 on 2020-10-22 14:15
3 from django.db import migrations
6 def populate_youtube_relations(apps, schema_editor):
7 YouTube = apps.get_model('youtube', 'YouTube')
8 ThumbnailTemplate = apps.get_model('youtube', 'ThumbnailTemplate')
9 Project = apps.get_model('archive', 'Project')
12 yt = YouTube.objects.first()
13 except YouTube.DoesNotExist:
14 yt = YouTube.objects.create(name='default')
16 Project.objects.filter(youtube=None).update(youtube=yt)
17 ThumbnailTemplate.objects.filter(youtube=None).update(youtube=yt)
20 class Migration(migrations.Migration):
23 ('youtube', '0015_auto_20201022_1414'),
24 ('archive', '0019_auto_20201022_1414'),
29 populate_youtube_relations,
30 migrations.RunPython.noop