On s'assure que les noms des alias sont courts

This commit is contained in:
Jean-Marie Favreau 2024-11-10 22:28:56 +01:00
parent b1dcd55ebc
commit 53e5b52711

View File

@ -0,0 +1,30 @@
# Generated by Django 4.2.9 on 2024-11-10 21:25
from django.db import migrations
def strip_place_aliases(apps, schema_editor):
Place = apps.get_model("agenda_culturel", "Place")
places = Place.objects.all()
for p in places:
if not p.aliases is None:
p.aliases = [a.strip() for a in p.aliases]
Place.objects.bulk_update(places, fields=["aliases"])
def do_nothing(apps, schema_editor):
pass
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0106_alter_event_other_versions'),
]
operations = [
migrations.RunPython(strip_place_aliases, reverse_code=do_nothing)
]