# Generated by Django 4.2.9 on 2025-01-24 17:48

import autoslug.fields
from django.db import migrations

def migrate_data_forward(apps, schema_editor):
    Category = apps.get_model("agenda_culturel", "Category")

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

def migrate_data_backward(apps, schema_editor):
    pass

class Migration(migrations.Migration):

    dependencies = [
        ('agenda_culturel', '0136_alter_recurrentimport_processor'),
    ]

    operations = [
        migrations.AddField(
            model_name='category',
            name='slug',
            field=autoslug.fields.AutoSlugField(default=None, editable=False, null=True, populate_from='name', unique=True),
        ),
        migrations.RunPython(
            migrate_data_forward,
            migrate_data_backward,
        ),
    ]
