"""Delete 4 stray PENTACLES court cards from the Earthman deck. These survived the migration collapse; the Earthman deck uses BRANDS/GRAILS/BLADES/CROWNS only. """ from django.db import migrations def delete_pentacles(apps, schema_editor): 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, suit="PENTACLES").delete() class Migration(migrations.Migration): dependencies = [ ("epic", "0011_nomad_schizo_icons"), ] operations = [ migrations.RunPython(delete_pentacles, reverse_code=migrations.RunPython.noop), ]