mirror of https://github.com/snachodog/mybuddy.git
Ensure overridden Sleep.save() is run on migration
This commit is contained in:
parent
124355ebb5
commit
c215ad9d0f
|
@ -2,9 +2,9 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
def set_napping(apps, schema_editor):
|
||||
Sleeps = apps.get_model('core', 'Sleep')
|
||||
for sleep in Sleeps.objects.all():
|
||||
sleep.napping = sleep.nap
|
||||
# The model must be imported to ensure its overridden `save` method is run.
|
||||
from core import models
|
||||
for sleep in models.Sleep.objects.all():
|
||||
sleep.save()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue