diff --git a/AKModel/migrations/0024_event_dependencies.py b/AKModel/migrations/0024_event_dependencies.py index 1fed7e230867fb0cd4345bf750db36a15580f4ae..17a89fdd1e087841bc5cc169dc3517a8d326cb9c 100644 --- a/AKModel/migrations/0024_event_dependencies.py +++ b/AKModel/migrations/0024_event_dependencies.py @@ -7,12 +7,12 @@ from AKModel.models import AKCategory, Event, AKTrack 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: instance.event = Event.objects.filter(active=True).last() instance.save() - for instance in AKTrack.objects.all(): + for instance in AKTrack.objects.only('event').all(): if not instance.event: instance.event = Event.objects.filter(active=True).last() instance.save()