Skip to content
Snippets Groups Projects
Commit 1ee8fb74 authored by Benjamin Hättasch's avatar Benjamin Hättasch
Browse files

Adapt event dependency migration to work with changed field lists of AKCategory and AKTrack

parent 3ee542eb
No related branches found
No related tags found
1 merge request!107Introduce and use a present_by_default attribute for AKCategory
Pipeline #23078 passed
...@@ -7,12 +7,12 @@ from AKModel.models import AKCategory, Event, AKTrack ...@@ -7,12 +7,12 @@ from AKModel.models import AKCategory, Event, AKTrack
def migrate_data_forward(apps, schema_editor): def migrate_data_forward(apps, schema_editor):
for instance in AKCategory.objects.all(): for instance in AKCategory.objects.only('event').all():
if not instance.event: if not instance.event:
instance.event = Event.objects.filter(active=True).last() instance.event = Event.objects.filter(active=True).last()
instance.save() instance.save()
for instance in AKTrack.objects.all(): for instance in AKTrack.objects.only('event').all():
if not instance.event: if not instance.event:
instance.event = Event.objects.filter(active=True).last() instance.event = Event.objects.filter(active=True).last()
instance.save() instance.save()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment