Compare commits
2 Commits
955bdc7f67
...
a133a9c1c3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a133a9c1c3 | ||
|
|
652cef09c0 |
@@ -259,6 +259,28 @@ class DeckVariant(models.Model):
|
||||
has_card_images = models.BooleanField(default=True)
|
||||
is_polarized = models.BooleanField(default=False)
|
||||
|
||||
@property
|
||||
def variant_dir_slug(self):
|
||||
"""Subdirectory under `cards-faces/<family>/` for this deck's images.
|
||||
Strips family-implied prefixes from `slug` (e.g., RWS slug is
|
||||
`tarot-rider-waite-smith` but lives at `english/rider-waite-smith/` —
|
||||
the "tarot-" is redundant under family=english). Earthman is special-
|
||||
cased to "default" per user-locked spec 2026-05-26: even though it's
|
||||
currently a single canonical deck, we lock in the variant tier now
|
||||
so future Earthman editions slot in alongside as `earthman/<variant>/`
|
||||
w.o. a path migration.
|
||||
|
||||
Mapping today:
|
||||
earthman / earthman → earthman/default
|
||||
italian / minchiate-... → italian/minchiate-fiorentine-1860-1890
|
||||
english / tarot-rws → english/rider-waite-smith (strip "tarot-")
|
||||
"""
|
||||
if self.family == self.EARTHMAN:
|
||||
return "default"
|
||||
if self.slug.startswith("tarot-"):
|
||||
return self.slug[len("tarot-"):]
|
||||
return self.slug
|
||||
|
||||
@property
|
||||
def back_image_url(self):
|
||||
"""Full static-asset URL for this deck's card-back image, or empty
|
||||
@@ -270,7 +292,7 @@ class DeckVariant(models.Model):
|
||||
return ""
|
||||
from django.templatetags.static import static
|
||||
return static(
|
||||
f"apps/epic/images/cards-faces/{self.slug}/{self.slug}-back.png"
|
||||
f"apps/epic/images/cards-faces/{self.family}/{self.variant_dir_slug}/{self.slug}-back.png"
|
||||
)
|
||||
|
||||
def suit_slug(self, canonical_suit):
|
||||
@@ -565,12 +587,18 @@ class TarotCard(models.Model):
|
||||
"""Full static-asset URL for the card image, or empty string if the
|
||||
deck has no images (legacy text-only mode). Constructed via Django's
|
||||
`static` helper so STATIC_URL prefix + manifest-versioning (when
|
||||
WhiteNoise compressed manifest is active) flow through."""
|
||||
WhiteNoise compressed manifest is active) flow through.
|
||||
|
||||
Path structure: `cards-faces/<family>/<variant_dir_slug>/<filename>`
|
||||
per the family-grouped tree convention (user spec 2026-05-26). See
|
||||
`DeckVariant.variant_dir_slug` for the variant subdir mapping.
|
||||
"""
|
||||
if not self.deck_variant.has_card_images:
|
||||
return ""
|
||||
from django.templatetags.static import static
|
||||
deck = self.deck_variant
|
||||
return static(
|
||||
f"apps/epic/images/cards-faces/{self.deck_variant.slug}/{self.image_filename}"
|
||||
f"apps/epic/images/cards-faces/{deck.family}/{deck.variant_dir_slug}/{self.image_filename}"
|
||||
)
|
||||
|
||||
@property
|
||||
|
||||
|
After Width: | Height: | Size: 1022 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 1006 KiB |
|
After Width: | Height: | Size: 984 KiB |
|
After Width: | Height: | Size: 996 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 931 KiB |
|
After Width: | Height: | Size: 928 KiB |
|
After Width: | Height: | Size: 797 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 856 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 905 KiB |
|
After Width: | Height: | Size: 890 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 915 KiB |
|
After Width: | Height: | Size: 964 KiB |
|
After Width: | Height: | Size: 984 KiB |
|
After Width: | Height: | Size: 927 KiB |
|
After Width: | Height: | Size: 919 KiB |
|
After Width: | Height: | Size: 864 KiB |
|
After Width: | Height: | Size: 786 KiB |
|
After Width: | Height: | Size: 947 KiB |
|
After Width: | Height: | Size: 967 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 995 KiB |
|
After Width: | Height: | Size: 966 KiB |
|
After Width: | Height: | Size: 866 KiB |
|
After Width: | Height: | Size: 907 KiB |
|
After Width: | Height: | Size: 870 KiB |
|
After Width: | Height: | Size: 879 KiB |
|
After Width: | Height: | Size: 933 KiB |
|
After Width: | Height: | Size: 956 KiB |
|
After Width: | Height: | Size: 958 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1006 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 934 KiB |
|
After Width: | Height: | Size: 908 KiB |
|
After Width: | Height: | Size: 945 KiB |
|
After Width: | Height: | Size: 946 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 973 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 1004 KiB |
|
After Width: | Height: | Size: 921 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 918 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 946 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 896 KiB |
|
After Width: | Height: | Size: 775 KiB |
|
After Width: | Height: | Size: 995 KiB |
|
After Width: | Height: | Size: 1004 KiB |
|
After Width: | Height: | Size: 976 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 938 KiB |
|
After Width: | Height: | Size: 964 KiB |
|
After Width: | Height: | Size: 989 KiB |
|
After Width: | Height: | Size: 1004 KiB |
|
After Width: | Height: | Size: 1000 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 360 KiB After Width: | Height: | Size: 360 KiB |
|
Before Width: | Height: | Size: 359 KiB After Width: | Height: | Size: 359 KiB |
|
Before Width: | Height: | Size: 383 KiB After Width: | Height: | Size: 383 KiB |
|
Before Width: | Height: | Size: 363 KiB After Width: | Height: | Size: 363 KiB |
|
Before Width: | Height: | Size: 348 KiB After Width: | Height: | Size: 348 KiB |
|
Before Width: | Height: | Size: 368 KiB After Width: | Height: | Size: 368 KiB |
|
Before Width: | Height: | Size: 400 KiB After Width: | Height: | Size: 400 KiB |
|
Before Width: | Height: | Size: 412 KiB After Width: | Height: | Size: 412 KiB |
|
Before Width: | Height: | Size: 412 KiB After Width: | Height: | Size: 412 KiB |
|
Before Width: | Height: | Size: 428 KiB After Width: | Height: | Size: 428 KiB |
|
Before Width: | Height: | Size: 426 KiB After Width: | Height: | Size: 426 KiB |
|
Before Width: | Height: | Size: 385 KiB After Width: | Height: | Size: 385 KiB |
|
Before Width: | Height: | Size: 367 KiB After Width: | Height: | Size: 367 KiB |
|
Before Width: | Height: | Size: 400 KiB After Width: | Height: | Size: 400 KiB |
|
Before Width: | Height: | Size: 384 KiB After Width: | Height: | Size: 384 KiB |
|
Before Width: | Height: | Size: 385 KiB After Width: | Height: | Size: 385 KiB |
|
Before Width: | Height: | Size: 300 KiB After Width: | Height: | Size: 300 KiB |
|
Before Width: | Height: | Size: 306 KiB After Width: | Height: | Size: 306 KiB |
|
Before Width: | Height: | Size: 393 KiB After Width: | Height: | Size: 393 KiB |
|
Before Width: | Height: | Size: 372 KiB After Width: | Height: | Size: 372 KiB |