On supprime la création de tags pendant la migration

This commit is contained in:
Jean-Marie Favreau 2024-11-19 20:36:05 +01:00
parent fe97c4cb32
commit 9ad3e9e972

View File

@ -184,15 +184,6 @@ def update_database_new(apps, schema_editor):
def update_database_old(apps, schema_editor):
update_database(apps, new_cats)
def add_tags(apps, schema_editor):
Tag = apps.get_model("agenda_culturel", "Tag")
new_tags = ["cinéma", "théâtre", "concert", "conférence", "exposition"]
new_tags = [Tag(name=t, description="", principal=True) for t in new_tags if Tag.objects.filter(name=t).count() == 0]
Tag.objects.bulk_create(new_tags)
def do_nothing(apps, schema_editor):
pass
@ -206,7 +197,6 @@ class Migration(migrations.Migration):
migrations.RunPython(create_new_categories, reverse_code=delete_new_categories),
migrations.RunPython(update_preserved_categories_new, reverse_code=update_preserved_categories_old),
migrations.RunPython(update_database_new, reverse_code=update_database_old),
migrations.RunPython(delete_old_categories, reverse_code=create_old_categories),
migrations.RunPython(add_tags, reverse_code=do_nothing)
migrations.RunPython(delete_old_categories, reverse_code=create_old_categories)
]