27 lines
693 B
Python
27 lines
693 B
Python
# Generated by Django 5.1.1 on 2024-09-14 07:05
|
|
|
|
from django.db import migrations, models
|
|
from django.utils.text import slugify
|
|
|
|
|
|
def update_empty_icons(apps, schema_editor):
|
|
Platform = apps.get_model("games", "Platform")
|
|
for platform in Platform.objects.filter(icon=""):
|
|
platform.icon = slugify(platform.name)
|
|
platform.save()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("games", "0036_alter_edition_platform"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name="platform",
|
|
name="icon",
|
|
field=models.SlugField(blank=True),
|
|
),
|
|
migrations.RunPython(update_empty_icons),
|
|
]
|