More data in catalogue
[redakcja.git] / src / cover / migrations / 0004_populate_use_file.py
1 # Generated by Django 3.1.13 on 2022-02-25 14:31
2
3 from django.db import migrations
4
5
6 def populate_use_file(apps, schema_editor):
7     Image = apps.get_model('cover', 'Image')
8     for img in Image.objects.all():
9         img.use_file.save(
10             "%d.jpg" % img.id,
11             img.file
12         )
13
14
15 class Migration(migrations.Migration):
16
17     dependencies = [
18         ('cover', '0003_auto_20220225_1431'),
19     ]
20
21     operations = [
22         migrations.RunPython(
23             populate_use_file,
24             migrations.RunPython.noop
25         )
26     ]