# Generated by Django 4.2.19 on 2025-03-02 12:40

import autoslug.fields
from django.db import migrations

def migrate_data_slug_forward(apps, schema_editor):
    ReferenceLocation = apps.get_model("agenda_culturel", "ReferenceLocation")

    for instance in ReferenceLocation.objects.all():
        print("Generating slug for %s"%instance)
        instance.save() # Will trigger slug update

def migrate_data_slug_backward(apps, schema_editor):
    pass

class Migration(migrations.Migration):

    dependencies = [
        ('agenda_culturel', '0001_squashed_0150_alter_event_local_image'),
    ]

    operations = [
        migrations.AddField(
            model_name='referencelocation',
            name='slug',
            field=autoslug.fields.AutoSlugField(default=None, editable=False, null=True, populate_from='name', unique=True),
        ),
        migrations.RunPython(
            code=migrate_data_slug_forward,
            reverse_code=migrate_data_slug_backward,
        ),
    ]
