Jacks & Cavaliers replaced in Earthman deck w. Maids & Jacks; numerals or numbers + symbols added to cards; migrations made in apps.epic to rename cards; _tarot_fan.html partial updated accordingly
This commit is contained in:
@@ -233,6 +233,38 @@ class TarotCard(models.Model):
|
||||
ordering = ["deck_variant", "arcana", "suit", "number"]
|
||||
unique_together = [("deck_variant", "slug")]
|
||||
|
||||
@staticmethod
|
||||
def _to_roman(n):
|
||||
if n == 0:
|
||||
return '0'
|
||||
val = [50, 40, 10, 9, 5, 4, 1]
|
||||
syms = ['L','XL','X','IX','V','IV','I']
|
||||
result = ''
|
||||
for v, s in zip(val, syms):
|
||||
while n >= v:
|
||||
result += s
|
||||
n -= v
|
||||
return result
|
||||
|
||||
@property
|
||||
def corner_rank(self):
|
||||
if self.arcana == self.MAJOR:
|
||||
return self._to_roman(self.number)
|
||||
court = {11: 'M', 12: 'J', 13: 'Q', 14: 'K'}
|
||||
return court.get(self.number, str(self.number))
|
||||
|
||||
@property
|
||||
def suit_icon(self):
|
||||
if self.arcana == self.MAJOR:
|
||||
return ''
|
||||
return {
|
||||
self.WANDS: 'fa-wand-sparkles',
|
||||
self.CUPS: 'fa-trophy',
|
||||
self.SWORDS: 'fa-gun',
|
||||
self.COINS: 'fa-sack-dollar',
|
||||
self.PENTACLES: 'fa-sack-dollar',
|
||||
}.get(self.suit, '')
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
Reference in New Issue
Block a user