progress on conversion to tailwind

This commit is contained in:
badblocks 2025-03-06 21:28:36 -08:00
parent 6a872124c6
commit 6e2843c60e
110 changed files with 4997 additions and 1691 deletions

View file

@ -52,6 +52,15 @@ class Rarity(models.Model):
def __str__(self):
return self.name
@property
def normalized_id(self):
"""
For trading equivalence: treat Special Art Rare (pk 7) and Super Rare (pk 6) as the same.
"""
if self.pk in (6, 7):
return 6
return self.pk
class Card(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=64)
@ -63,4 +72,12 @@ class Card(models.Model):
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return self.name + " " + self.rarity.icons + " " + self.cardset.name
# For display, we show the original rarity icons.
return f"{self.name} {self.rarity.icons} {self.cardset.name}"
@property
def normalized_rarity(self):
"""
Returns the canonical rarity id for trade logic.
"""
return self.rarity.normalized_id