diff --git a/jarvis/objective/migrations/0019_alter_passe_options_trainingprogram_informations_and_more.py b/jarvis/objective/migrations/0019_alter_passe_options_trainingprogram_informations_and_more.py new file mode 100644 index 0000000..68ce75d --- /dev/null +++ b/jarvis/objective/migrations/0019_alter_passe_options_trainingprogram_informations_and_more.py @@ -0,0 +1,33 @@ +# Generated by Django 4.2 on 2024-03-03 10:45 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("objective", "0018_alter_trainingprogram_options_and_more"), + ] + + operations = [ + migrations.AlterModelOptions( + name="passe", + options={"ordering": ["label"]}, + ), + migrations.AddField( + model_name="trainingprogram", + name="informations", + field=models.TextField( + blank=True, + help_text="Only MarkDown is authorized", + null=True, + verbose_name="Comments", + ), + ), + migrations.AlterField( + model_name="passe", + name="label", + field=models.CharField(default="-", max_length=30), + preserve_default=False, + ), + ] diff --git a/jarvis/objective/models.py b/jarvis/objective/models.py index 5586fb0..fbef545 100644 --- a/jarvis/objective/models.py +++ b/jarvis/objective/models.py @@ -465,7 +465,10 @@ class RoutineSkill(models.Model): class Passe(Markdownizable): """Classe représentant les passages (à faire pendant un entraînement).""" - label = models.CharField(max_length=30, null=True, blank=True) + class Meta: + ordering = ["label"] + + label = models.CharField(max_length=30) educatives = models.ManyToManyField(Educative) regexp = models.CharField(max_length=50, null=True, blank=True) number_of_skill = models.PositiveSmallIntegerField(default=0) @@ -522,13 +525,10 @@ class Passe(Markdownizable): super().save(*args, **kwargs) def __str__(self): - if self.label: - return f"{self.label} ({self.number_of_skill} | {self.difficulty})" - else: - return f"- ({self.number_of_skill} | {self.difficulty})" + return f"{self.label} ({self.number_of_skill} | {self.difficulty})" -class TrainingProgram(Seasonisable): +class TrainingProgram(Seasonisable, Markdownizable): """Classe représentant un entraînement (ensemble de passage).""" class Meta: diff --git a/jarvis/objective/templates/passes/details.html b/jarvis/objective/templates/passes/details.html index 5558adf..33d52d5 100644 --- a/jarvis/objective/templates/passes/details.html +++ b/jarvis/objective/templates/passes/details.html @@ -1,21 +1,89 @@ {% extends "base.html" %} {% load has_group %} -{% block page_title %}{{ combination.short_label }}{% endblock %} +{% block page_title %}Passe details{% endblock %} {% block content %}