39 lines
1.0 KiB
Python
39 lines
1.0 KiB
Python
# Generated by Django 5.1.5 on 2025-02-01 19:18
|
|
|
|
from django.db import migrations, models
|
|
|
|
|
|
def set_finished_status(apps, schema_editor):
|
|
Game = apps.get_model("games", "Game")
|
|
Game.objects.filter(purchases__date_finished__isnull=False).update(status="f")
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("games", "0004_purchase_num_purchases"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name="game",
|
|
name="mastered",
|
|
field=models.BooleanField(default=False),
|
|
),
|
|
migrations.AddField(
|
|
model_name="game",
|
|
name="status",
|
|
field=models.CharField(
|
|
choices=[
|
|
("u", "Unplayed"),
|
|
("p", "Played"),
|
|
("f", "Finished"),
|
|
("r", "Retired"),
|
|
("a", "Abandoned"),
|
|
],
|
|
default="u",
|
|
max_length=1,
|
|
),
|
|
),
|
|
migrations.RunPython(set_finished_status),
|
|
]
|