Skip to content

Commit

Permalink
Migrate astronuats to new status.
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsCalebJones committed Apr 26, 2019
1 parent b2eb42a commit 6bb5ca2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 51 deletions.
26 changes: 26 additions & 0 deletions astronaut.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import os
import django

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "spacelaunchnow.settings")
django.setup()

from api.models import *
from configurations.models import *

if __name__ == '__main__':
deceased, created = AstronautStatus.objects.get_or_create(name='Deceased')
retired = AstronautStatus.objects.get(name='Retired')
retired_with_death_date = Astronaut.objects.filter(status=retired).filter(date_of_death__isnull=False)
for astronaut in retired_with_death_date:
print("--------------------------------")
print(astronaut)
print(astronaut.status)
print(astronaut.date_of_death)
print("Migrating...")
astronaut.status = deceased
astronaut.save()
print(astronaut)
print(astronaut.status)
print(astronaut.date_of_death)
print("--------------------------------")
print("/n")
51 changes: 0 additions & 51 deletions rerun_models.py

This file was deleted.

0 comments on commit 6bb5ca2

Please sign in to comment.