diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-02-26 11:41:41 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-04-16 16:42:32 +0200 |
commit | 50dd359c1981bd4136c9dedf7a147bed9c1b47bf (patch) | |
tree | 1a328ff8a6f97f06bd2d5d4f8990694136037a7b /ishtar_common/migrations | |
parent | a634566637d52380f1289be46bdcfd9e636f31af (diff) | |
download | Ishtar-50dd359c1981bd4136c9dedf7a147bed9c1b47bf.tar.bz2 Ishtar-50dd359c1981bd4136c9dedf7a147bed9c1b47bf.zip |
🗃️ add slug to biographical notes
Diffstat (limited to 'ishtar_common/migrations')
-rw-r--r-- | ishtar_common/migrations/0238_biographicalnote_slug.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/ishtar_common/migrations/0238_biographicalnote_slug.py b/ishtar_common/migrations/0238_biographicalnote_slug.py new file mode 100644 index 000000000..faa25d699 --- /dev/null +++ b/ishtar_common/migrations/0238_biographicalnote_slug.py @@ -0,0 +1,35 @@ +# Generated by Django 2.2.24 on 2024-02-26 11:40 + +from django.db import migrations, models +from ishtar_common.utils import create_slug + + +def set_slug(apps, __): + BiographicalNote = apps.get_model('ishtar_common', 'BiographicalNote') + for bn in BiographicalNote.objects.all(): + bn.slug = create_slug(BiographicalNote, bn.denomination, max_length=250, pk=bn.pk) + bn.skip_history_when_saving = True + bn.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('ishtar_common', '0237_data_migration_licenses_shootingangle'), + ] + + operations = [ + migrations.AddField( + model_name='biographicalnote', + name='slug', + field=models.SlugField(blank=True, help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', max_length=300, null=True, verbose_name='Textual ID'), + ), + migrations.RunPython(set_slug), + migrations.AlterField( + model_name='biographicalnote', + name='slug', + field=models.SlugField(blank=True, + help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', + max_length=300, verbose_name='Textual ID'), + ), + ] |