mirror of
https://github.com/Crocmagnon/charasheet.git
synced 2024-11-25 16:08:03 +01:00
Translate fields
This commit is contained in:
parent
8196422f9e
commit
1be70dfe6f
5 changed files with 125 additions and 66 deletions
|
@ -10,7 +10,7 @@ class CapabilityAdmin(admin.ModelAdmin):
|
|||
search_fields = ["name", "description"]
|
||||
fieldsets = [
|
||||
(None, {"fields": ["name"]}),
|
||||
("Path", {"fields": [("path", "rank")]}),
|
||||
("Voie", {"fields": [("path", "rank")]}),
|
||||
("Type", {"fields": [("limited", "spell")]}),
|
||||
("Description", {"fields": ["description"]}),
|
||||
("Documentation", {"fields": ["url"]}),
|
||||
|
@ -24,7 +24,7 @@ class PathAdmin(admin.ModelAdmin):
|
|||
search_fields = ["name"]
|
||||
fieldsets = [
|
||||
(None, {"fields": ["name"]}),
|
||||
("Related to", {"fields": ["category", ("profile", "race")]}),
|
||||
("Lié à", {"fields": ["category", ("profile", "race")]}),
|
||||
("Notes", {"fields": ["notes"]}),
|
||||
("Documentation", {"fields": ["url"]}),
|
||||
]
|
||||
|
@ -85,12 +85,12 @@ class CharacterAdmin(admin.ModelAdmin):
|
|||
|
||||
fieldsets = [
|
||||
(
|
||||
"Identity",
|
||||
"Identité",
|
||||
{"fields": ["name", "player", "profile", "level", "race"]},
|
||||
),
|
||||
("Appearance", {"fields": ["gender", "age", "height", "weight"]}),
|
||||
("Apparence", {"fields": ["gender", "age", "height", "weight"]}),
|
||||
(
|
||||
"Abilities",
|
||||
"Caractéristiques",
|
||||
{
|
||||
"fields": [
|
||||
("value_strength", "modifier_strength"),
|
||||
|
@ -103,15 +103,15 @@ class CharacterAdmin(admin.ModelAdmin):
|
|||
},
|
||||
),
|
||||
(
|
||||
"Fight",
|
||||
"Combat",
|
||||
{"fields": ["initiative", "attack_melee", "attack_range", "attack_magic"]},
|
||||
),
|
||||
("Health", {"fields": ["health_max", "health_remaining"]}),
|
||||
("Defense", {"fields": ["armor", "shield", "defense_misc", "defense"]}),
|
||||
("Weapons & equipment", {"fields": ["weapons", "equipment"]}),
|
||||
("Racial", {"fields": ["racial_capability"]}),
|
||||
("Capabilities", {"fields": ["capabilities"]}),
|
||||
("Luck", {"fields": ["luck_points_max", "luck_points_remaining"]}),
|
||||
("Vitalité", {"fields": ["health_max", "health_remaining"]}),
|
||||
("Défense", {"fields": ["armor", "shield", "defense_misc", "defense"]}),
|
||||
("Armes & équipement", {"fields": ["weapons", "equipment"]}),
|
||||
("Race", {"fields": ["racial_capability"]}),
|
||||
("Capacités", {"fields": ["capabilities"]}),
|
||||
("Chance", {"fields": ["luck_points_max", "luck_points_remaining"]}),
|
||||
("Mana", {"fields": ["mana_max", "mana_consumed", "mana_remaining"]}),
|
||||
("Notes", {"fields": ["notes"]}),
|
||||
]
|
||||
|
|
|
@ -12,6 +12,7 @@ class Path(DocumentedModel, UniquelyNamedModel, TimeStampedModel, models.Model):
|
|||
related_name="paths",
|
||||
blank=True,
|
||||
null=True,
|
||||
verbose_name="profil",
|
||||
)
|
||||
race = models.ForeignKey(
|
||||
"character.Race",
|
||||
|
@ -19,30 +20,44 @@ class Path(DocumentedModel, UniquelyNamedModel, TimeStampedModel, models.Model):
|
|||
related_name="paths",
|
||||
blank=True,
|
||||
null=True,
|
||||
verbose_name="race",
|
||||
)
|
||||
|
||||
class Category(models.TextChoices):
|
||||
PROFILE = "profile", "Profile"
|
||||
PROFILE = "profile", "Profil"
|
||||
RACE = "race", "Race"
|
||||
PRESTIGE = "prestige", "Prestige"
|
||||
CREATURE = "creature", "Creature"
|
||||
CREATURE = "creature", "Créature"
|
||||
|
||||
category = models.CharField(max_length=20, choices=Category.choices)
|
||||
notes = models.TextField(blank=True)
|
||||
category = models.CharField(
|
||||
max_length=20, choices=Category.choices, verbose_name="catégorie"
|
||||
)
|
||||
notes = models.TextField(blank=True, verbose_name="notes")
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Voie"
|
||||
verbose_name_plural = "Voies"
|
||||
|
||||
|
||||
class Capability(DocumentedModel, UniquelyNamedModel, TimeStampedModel, models.Model):
|
||||
path = models.ForeignKey("character.Path", on_delete=models.CASCADE)
|
||||
rank = models.PositiveSmallIntegerField(
|
||||
validators=[MinValueValidator(1), MaxValueValidator(5)]
|
||||
path = models.ForeignKey(
|
||||
"character.Path", on_delete=models.CASCADE, verbose_name="voie"
|
||||
)
|
||||
limited = models.BooleanField(blank=True, null=False, default=False)
|
||||
spell = models.BooleanField(blank=True, null=False, default=False)
|
||||
description = models.TextField()
|
||||
rank = models.PositiveSmallIntegerField(
|
||||
validators=[MinValueValidator(1), MaxValueValidator(5)], verbose_name="rang"
|
||||
)
|
||||
limited = models.BooleanField(
|
||||
blank=True, null=False, default=False, verbose_name="limitée"
|
||||
)
|
||||
spell = models.BooleanField(
|
||||
blank=True, null=False, default=False, verbose_name="sort"
|
||||
)
|
||||
description = models.TextField(verbose_name="description")
|
||||
|
||||
class Meta:
|
||||
constraints = [models.UniqueConstraint("path", "rank", name="unique_path_rank")]
|
||||
verbose_name_plural = "Capabilities"
|
||||
verbose_name = "Capacité"
|
||||
verbose_name_plural = "Capacités"
|
||||
|
||||
|
||||
class RacialCapabilityManager(models.Manager):
|
||||
|
@ -51,14 +66,17 @@ class RacialCapabilityManager(models.Manager):
|
|||
|
||||
|
||||
class RacialCapability(DocumentedModel, TimeStampedModel, models.Model):
|
||||
name = models.CharField(max_length=100, blank=False, null=False)
|
||||
race = models.ForeignKey("character.Race", on_delete=models.CASCADE)
|
||||
description = models.TextField()
|
||||
name = models.CharField(max_length=100, blank=False, null=False, verbose_name="nom")
|
||||
race = models.ForeignKey(
|
||||
"character.Race", on_delete=models.CASCADE, verbose_name="race"
|
||||
)
|
||||
description = models.TextField(verbose_name="description")
|
||||
|
||||
objects = RacialCapabilityManager()
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "Racial capabilities"
|
||||
verbose_name = "Capacité raciale"
|
||||
verbose_name_plural = "Capacités raciales"
|
||||
constraints = [models.UniqueConstraint("name", "race", name="unique_name_race")]
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
@ -9,20 +9,31 @@ from common.models import DocumentedModel, UniquelyNamedModel
|
|||
|
||||
class Profile(DocumentedModel, UniquelyNamedModel, TimeStampedModel, models.Model):
|
||||
class MagicalStrength(models.TextChoices):
|
||||
NONE = "NON", "None"
|
||||
NONE = "NON", "Aucun"
|
||||
INTELLIGENCE = "INT", "Intelligence"
|
||||
WISDOM = "SAG", "Wisdom"
|
||||
CHARISMA = "CHA", "Charisma"
|
||||
WISDOM = "SAG", "Sagesse"
|
||||
CHARISMA = "CHA", "Charisme"
|
||||
|
||||
magical_strength = models.CharField(
|
||||
max_length=3, choices=MagicalStrength.choices, default=MagicalStrength.NONE
|
||||
max_length=3,
|
||||
choices=MagicalStrength.choices,
|
||||
default=MagicalStrength.NONE,
|
||||
verbose_name="force magique",
|
||||
)
|
||||
life_dice = models.PositiveSmallIntegerField(choices=Dice.choices)
|
||||
notes = models.TextField(blank=True)
|
||||
life_dice = models.PositiveSmallIntegerField(
|
||||
choices=Dice.choices, verbose_name="dé de vie"
|
||||
)
|
||||
notes = models.TextField(blank=True, verbose_name="notes")
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Profil"
|
||||
verbose_name_plural = "Profils"
|
||||
|
||||
|
||||
class Race(DocumentedModel, UniquelyNamedModel, TimeStampedModel, models.Model):
|
||||
pass
|
||||
class Meta:
|
||||
verbose_name = "Race"
|
||||
verbose_name_plural = "Races"
|
||||
|
||||
|
||||
def modifier(value: int) -> int:
|
||||
|
@ -39,69 +50,93 @@ class CharacterManager(models.Manager):
|
|||
|
||||
class Character(models.Model):
|
||||
class Gender(models.TextChoices):
|
||||
MALE = "M", "Male"
|
||||
FEMALE = "F", "Female"
|
||||
OTHER = "O", "Other"
|
||||
MALE = "M", "Mâle"
|
||||
FEMALE = "F", "Femelle"
|
||||
OTHER = "O", "Autre"
|
||||
|
||||
name = models.CharField(max_length=100)
|
||||
name = models.CharField(max_length=100, verbose_name="nom")
|
||||
player = models.ForeignKey(
|
||||
"common.User", on_delete=models.CASCADE, related_name="characters"
|
||||
"common.User",
|
||||
on_delete=models.CASCADE,
|
||||
related_name="characters",
|
||||
verbose_name="joueur",
|
||||
)
|
||||
|
||||
race = models.ForeignKey(
|
||||
"character.Race",
|
||||
on_delete=models.PROTECT,
|
||||
related_name="characters",
|
||||
verbose_name="race",
|
||||
)
|
||||
profile = models.ForeignKey(
|
||||
"character.Profile",
|
||||
on_delete=models.PROTECT,
|
||||
related_name="characters",
|
||||
verbose_name="profil",
|
||||
)
|
||||
level = models.PositiveSmallIntegerField()
|
||||
level = models.PositiveSmallIntegerField(verbose_name="niveau")
|
||||
|
||||
gender = models.CharField(
|
||||
max_length=1, choices=Gender.choices, default=Gender.OTHER
|
||||
max_length=1, choices=Gender.choices, default=Gender.OTHER, verbose_name="genre"
|
||||
)
|
||||
age = models.PositiveSmallIntegerField()
|
||||
height = models.PositiveSmallIntegerField()
|
||||
weight = models.PositiveSmallIntegerField()
|
||||
age = models.PositiveSmallIntegerField(verbose_name="âge")
|
||||
height = models.PositiveSmallIntegerField(verbose_name="taille")
|
||||
weight = models.PositiveSmallIntegerField(verbose_name="poids")
|
||||
|
||||
value_strength = models.PositiveSmallIntegerField()
|
||||
value_dexterity = models.PositiveSmallIntegerField()
|
||||
value_constitution = models.PositiveSmallIntegerField()
|
||||
value_intelligence = models.PositiveSmallIntegerField()
|
||||
value_wisdom = models.PositiveSmallIntegerField()
|
||||
value_charisma = models.PositiveSmallIntegerField()
|
||||
value_strength = models.PositiveSmallIntegerField(verbose_name="valeur force")
|
||||
value_dexterity = models.PositiveSmallIntegerField(verbose_name="valeur dextérité")
|
||||
value_constitution = models.PositiveSmallIntegerField(
|
||||
verbose_name="valeur constitution"
|
||||
)
|
||||
value_intelligence = models.PositiveSmallIntegerField(
|
||||
verbose_name="valeur intelligence"
|
||||
)
|
||||
value_wisdom = models.PositiveSmallIntegerField(verbose_name="valeur sagesse")
|
||||
value_charisma = models.PositiveSmallIntegerField(verbose_name="valeur charisme")
|
||||
|
||||
health_max = models.PositiveSmallIntegerField()
|
||||
health_remaining = models.PositiveSmallIntegerField()
|
||||
health_max = models.PositiveSmallIntegerField(verbose_name="points de vie max")
|
||||
health_remaining = models.PositiveSmallIntegerField(
|
||||
verbose_name="points de vie restants"
|
||||
)
|
||||
|
||||
racial_capability = models.ForeignKey(
|
||||
"character.RacialCapability",
|
||||
on_delete=models.PROTECT,
|
||||
related_name="characters",
|
||||
verbose_name="capacité raciale",
|
||||
)
|
||||
|
||||
weapons = models.ManyToManyField("character.Weapon", blank=True)
|
||||
weapons = models.ManyToManyField(
|
||||
"character.Weapon", blank=True, verbose_name="armes"
|
||||
)
|
||||
|
||||
armor = models.PositiveSmallIntegerField()
|
||||
shield = models.PositiveSmallIntegerField()
|
||||
defense_misc = models.SmallIntegerField()
|
||||
armor = models.PositiveSmallIntegerField(verbose_name="armure")
|
||||
shield = models.PositiveSmallIntegerField(verbose_name="bouclier")
|
||||
defense_misc = models.SmallIntegerField(verbose_name="divers défense")
|
||||
|
||||
capabilities = models.ManyToManyField("character.Capability", blank=True)
|
||||
capabilities = models.ManyToManyField(
|
||||
"character.Capability", blank=True, verbose_name="capacités"
|
||||
)
|
||||
|
||||
equipment = models.TextField(blank=True)
|
||||
luck_points_max = models.PositiveSmallIntegerField()
|
||||
luck_points_remaining = models.PositiveSmallIntegerField()
|
||||
equipment = models.TextField(blank=True, verbose_name="équipement")
|
||||
luck_points_max = models.PositiveSmallIntegerField(
|
||||
verbose_name="points de chance max"
|
||||
)
|
||||
luck_points_remaining = models.PositiveSmallIntegerField(
|
||||
verbose_name="points de chance restants"
|
||||
)
|
||||
|
||||
mana_consumed = models.PositiveSmallIntegerField(default=0)
|
||||
mana_consumed = models.PositiveSmallIntegerField(
|
||||
default=0, verbose_name="mana utilisé"
|
||||
)
|
||||
|
||||
notes = models.TextField(blank=True)
|
||||
notes = models.TextField(blank=True, verbose_name="notes")
|
||||
|
||||
objects = CharacterManager()
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Personnage"
|
||||
verbose_name_plural = "Personnages"
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
Lower("name"), "player", name="unique_character_player"
|
||||
|
|
|
@ -5,5 +5,9 @@ from common.models import UniquelyNamedModel
|
|||
|
||||
|
||||
class Weapon(UniquelyNamedModel, TimeStampedModel, models.Model):
|
||||
damage = models.CharField(max_length=50, blank=True)
|
||||
special = models.TextField(blank=True)
|
||||
damage = models.CharField(max_length=50, blank=True, verbose_name="dégâts")
|
||||
special = models.TextField(blank=True, verbose_name="spécial")
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Arme"
|
||||
verbose_name_plural = "Armes"
|
||||
|
|
|
@ -14,7 +14,9 @@ class UniquelyNamedModelManager(models.Manager):
|
|||
|
||||
|
||||
class UniquelyNamedModel(models.Model):
|
||||
name = models.CharField(max_length=100, blank=False, null=False, unique=True)
|
||||
name = models.CharField(
|
||||
max_length=100, blank=False, null=False, unique=True, verbose_name="nom"
|
||||
)
|
||||
objects = UniquelyNamedModelManager()
|
||||
|
||||
class Meta:
|
||||
|
@ -28,7 +30,7 @@ class UniquelyNamedModel(models.Model):
|
|||
|
||||
|
||||
class DocumentedModel(models.Model):
|
||||
url = models.URLField(blank=True, null=False)
|
||||
url = models.URLField(blank=True, null=False, verbose_name="url")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
|
Loading…
Reference in a new issue