1 # Generated by Django 4.0.8 on 2023-08-02 19:58
4 from django.conf import settings
5 from django.db import migrations
8 def migrate_fundraising(apps, schema_editor):
9 MIS = apps.get_model('annoy', 'MediaInsertSet')
10 EF = getattr(settings, 'EPUB_FUNDRAISING', None)
13 etag = hashlib.sha1(json.dumps(EF).encode('utf-8')).hexdigest()
14 for f in ('epub', 'mobi'):
15 mis = MIS.objects.create(file_format=f, etag=etag)
16 for i, t in enumerate(EF):
17 mis.mediainserttext_set.create(ordering=i+1, text=t)
20 class Migration(migrations.Migration):
23 ('annoy', '0013_mediainsertset_mediainserttext'),
29 migrations.RunPython.noop