39 lines
926 B
Python
39 lines
926 B
Python
|
|
"""Rename the Blades Middle Arcana reversal qualifier "Nervous" → "Fickle"."""
|
||
|
|
from django.db import migrations
|
||
|
|
|
||
|
|
|
||
|
|
SUIT = "BLADES"
|
||
|
|
COURT_NUMBERS = [11, 12, 13, 14]
|
||
|
|
OLD = "Nervous"
|
||
|
|
NEW = "Fickle"
|
||
|
|
|
||
|
|
|
||
|
|
def _update(apps, value):
|
||
|
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||
|
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||
|
|
try:
|
||
|
|
earthman = DeckVariant.objects.get(slug="earthman")
|
||
|
|
except DeckVariant.DoesNotExist:
|
||
|
|
return
|
||
|
|
TarotCard.objects.filter(
|
||
|
|
deck_variant=earthman,
|
||
|
|
arcana="MIDDLE",
|
||
|
|
suit=SUIT,
|
||
|
|
number__in=COURT_NUMBERS,
|
||
|
|
).update(reversal_qualifier=value)
|
||
|
|
|
||
|
|
|
||
|
|
def forward(apps, schema_editor):
|
||
|
|
_update(apps, NEW)
|
||
|
|
|
||
|
|
|
||
|
|
def backward(apps, schema_editor):
|
||
|
|
_update(apps, OLD)
|
||
|
|
|
||
|
|
|
||
|
|
class Migration(migrations.Migration):
|
||
|
|
dependencies = [
|
||
|
|
("epic", "0007_finalize_earthman_deck"),
|
||
|
|
]
|
||
|
|
operations = [migrations.RunPython(forward, backward)]
|