Skip to content
Snippets Groups Projects

Introduce and use a present_by_default attribute for AKCategory

Merged Benjamin Hättasch requested to merge feature-present-default into main
1 file
+ 2
2
Compare changes
  • Side-by-side
  • Inline
@@ -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()
Loading