You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
994 B
30 lines
994 B
# Generated by Django 5.1 on 2024-12-13 13:04
|
|
|
|
from django.db import migrations
|
|
|
|
def init_store_id(apps, schema_editor):
|
|
models = ["GroupStage", "Round", "TeamRegistration", "PlayerRegistration", "Match", "TeamScore", "DrawLog"]
|
|
for model in models:
|
|
Model = apps.get_model("tournaments", model)
|
|
for instance in Model.objects.all():
|
|
instance.store_id = str(instance.tournament_id())
|
|
instance.save()
|
|
|
|
def init_related_names(apps, schema_editor):
|
|
models = ["Club", "Event"]
|
|
for model in models:
|
|
Model = apps.get_model("tournaments", model)
|
|
for instance in Model.objects.all():
|
|
instance.related_user = instance.creator
|
|
instance.save()
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('tournaments', '0095_club_creation_date_club_last_update_and_more'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(init_store_id),
|
|
migrations.RunPython(init_related_names),
|
|
]
|
|
|