23 lines
563 B
Python
23 lines
563 B
Python
|
# Generated by Django 4.2.7 on 2023-12-22 10:09
|
||
|
|
||
|
from django.db import migrations
|
||
|
|
||
|
from games.models import Purchase
|
||
|
|
||
|
|
||
|
def set_default_state(apps, schema_editor):
|
||
|
Purchase.objects.filter(session__isnull=False).update(
|
||
|
status=Purchase.PurchaseState.PLAYING
|
||
|
)
|
||
|
Purchase.objects.filter(date_finished__isnull=False).update(
|
||
|
status=Purchase.PurchaseState.FINISHED
|
||
|
)
|
||
|
|
||
|
|
||
|
class Migration(migrations.Migration):
|
||
|
dependencies = [
|
||
|
("games", "0034_purchase_status"),
|
||
|
]
|
||
|
|
||
|
operations = [migrations.RunPython(set_default_state)]
|