1 # Generated by Django 3.0.6 on 2020-05-29 11:57
3 from django.db import migrations
6 def url_to_slug(apps, schema_editor):
7 Audiobook = apps.get_model('archive', 'Audiobook')
8 for a in Audiobook.objects.all():
9 a.slug = a.url.rstrip().rstrip('/').rsplit('/', 1)[-1]
12 def slug_to_url(apps, schema_editor):
13 Audiobook = apps.get_model('archive', 'Audiobook')
14 for a in Audiobook.objects.all():
15 a.url = 'https://wolnelektury.pl/katalog/lektura/{}/'.format(a.slug)
19 class Migration(migrations.Migration):
22 ('archive', '0011_audiobook_slug'),