first commit

This commit is contained in:
Maxim
2025-12-11 18:15:56 +03:00
commit d451ca7d3a
6071 changed files with 786794 additions and 0 deletions

37
api/models.py Normal file
View File

@@ -0,0 +1,37 @@
from django.db import models
class Hero(models.Model):
PRIMARY_ATTR_STRENGTH = "Strength"
PRIMARY_ATTR_AGILITY = "Agility"
PRIMARY_ATTR_INTELLIGENCE = "Intelligence"
PRIMARY_CHOICES = (
(PRIMARY_ATTR_STRENGTH, "Strength"),
(PRIMARY_ATTR_AGILITY, "Agility"),
(PRIMARY_ATTR_INTELLIGENCE, "Intelligence"),
)
name = models.CharField(max_length=200)
primary = models.CharField(max_length=20, choices=PRIMARY_CHOICES)
def __str__(self) -> str: # pragma: no cover - convenience only
return f"{self.name} ({self.primary})"
class Item(models.Model):
name = models.CharField(max_length=200)
def __str__(self) -> str: # pragma: no cover - convenience only
return self.name
class Aspect(models.Model):
hero = models.ForeignKey(Hero, on_delete=models.CASCADE, related_name="aspects")
name = models.CharField(max_length=200)
class Meta:
unique_together = ["hero", "name"]
def __str__(self) -> str: # pragma: no cover - convenience only
return f"{self.hero.name} - {self.name}"