-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Rename old coming soon episodes (#1723)
- Loading branch information
1 parent
24406fc
commit a3fb2e3
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from django.apps.registry import Apps | ||
from django.db import migrations | ||
|
||
|
||
def rename_episodes(apps: Apps, *args): | ||
Episode = apps.get_model("game", "Episode") | ||
|
||
episode13 = Episode.objects.get(pk=13) | ||
episode14 = Episode.objects.get(pk=14) | ||
episode15 = Episode.objects.get(pk=15) | ||
|
||
episode13.name = "Indeterminate Loops" | ||
episode14.name = "Selection in a Loop" | ||
episode15.name = "For Loops" | ||
|
||
episode13.save() | ||
episode14.save() | ||
episode15.save() | ||
|
||
|
||
def unrename_episodes(apps: Apps, *args): | ||
Episode = apps.get_model("game", "Episode") | ||
|
||
episode13 = Episode.objects.get(pk=13) | ||
episode14 = Episode.objects.get(pk=14) | ||
episode15 = Episode.objects.get(pk=15) | ||
|
||
episode13.name = "Indeterminate While Loops - coming soon" | ||
episode14.name = "Selection in a Loop - coming soon" | ||
episode15.name = "For Loops - coming soon" | ||
|
||
episode13.save() | ||
episode14.save() | ||
episode15.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [("game", "0100_reorder_python_levels")] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
code=rename_episodes, reverse_code=unrename_episodes | ||
) | ||
] |