diff --git a/jarvis/followup/admin.py b/jarvis/followup/admin.py index ad4f16a..ff48c1c 100644 --- a/jarvis/followup/admin.py +++ b/jarvis/followup/admin.py @@ -112,14 +112,21 @@ class InjuryAdmin(admin.ModelAdmin): "mechanism", "nb_week_off", "informations", - ) # educative + ) readonly_fields = ("season", "week_number", "created_at", "updated_at") - list_display = ("date", "gymnast", "skill") # educative + list_display = ( + "date", + "gymnast", + "mechanism", + "location", + "body_side", + "nb_week_off", + ) list_filter = ( ("gymnast", RelatedDropdownFilter), + ("mechanism", DropdownFilter), ("location", RelatedDropdownFilter), ("body_side", DropdownFilter), - ("mechanism", DropdownFilter), ) date_hierarchy = "date" search_fields = ("date", "gymnast") # educative diff --git a/jarvis/followup/forms.py b/jarvis/followup/forms.py index 0e8b4ff..6c2ae8b 100644 --- a/jarvis/followup/forms.py +++ b/jarvis/followup/forms.py @@ -191,6 +191,7 @@ class InjuryForm(forms.ModelForm): "location", "body_side", "nb_week_off", + "diagnosis", "informations", ) widgets = { @@ -209,10 +210,16 @@ class InjuryForm(forms.ModelForm): "nb_week_off": forms.NumberInput( attrs={"class": "form-control", "placeholder": "xx"} ), + "diagnosis": forms.Textarea( + attrs={ + "class": "form-control", + "placeholder": "Informations about diagnosis", # pylint: disable=line-too-long + } + ), "informations": forms.Textarea( attrs={ "class": "form-control", - "placeholder": "Informations about injury: context (why, where, …), consequencies, re-education exercices, …", # pylint: disable=line-too-long + "placeholder": "Informations about injury: consequencies, re-education exercices, …", # pylint: disable=line-too-long } ), } diff --git a/jarvis/followup/migrations/0052_injury_location.py b/jarvis/followup/migrations/0052_injury_location.py index c54285b..d901d06 100644 --- a/jarvis/followup/migrations/0052_injury_location.py +++ b/jarvis/followup/migrations/0052_injury_location.py @@ -15,7 +15,6 @@ class Migration(migrations.Migration): model_name="injury", name="location", field=models.ForeignKey( - # default=1, on_delete=django.db.models.deletion.CASCADE, related_name="injuries", to="followup.injurylocation", @@ -24,6 +23,5 @@ class Migration(migrations.Migration): null=True, blank=True, ), - # preserve_default=False, ), ] diff --git a/jarvis/followup/migrations/0056_alter_injury_location.py b/jarvis/followup/migrations/0056_alter_injury_location.py new file mode 100644 index 0000000..e16777a --- /dev/null +++ b/jarvis/followup/migrations/0056_alter_injury_location.py @@ -0,0 +1,24 @@ +# Generated by Django 4.2 on 2023-07-08 17:53 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ("followup", "0055_alter_injury_body_side"), + ] + + operations = [ + migrations.AlterField( + model_name="injury", + name="location", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="injuries", + to="followup.injurylocation", + verbose_name="Location", + ), + ), + ] diff --git a/jarvis/followup/migrations/0057_injury_diagnosis.py b/jarvis/followup/migrations/0057_injury_diagnosis.py new file mode 100644 index 0000000..1746ac9 --- /dev/null +++ b/jarvis/followup/migrations/0057_injury_diagnosis.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2 on 2023-07-08 18:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("followup", "0056_alter_injury_location"), + ] + + operations = [ + migrations.AddField( + model_name="injury", + name="diagnosis", + field=models.TextField( + blank=True, + help_text="Only normal text is authorized", + null=True, + verbose_name="Diagnosis", + ), + ), + ] diff --git a/jarvis/followup/models.py b/jarvis/followup/models.py index a5e67ff..a40178e 100644 --- a/jarvis/followup/models.py +++ b/jarvis/followup/models.py @@ -199,6 +199,12 @@ class Injury(Markdownizable, Seasonisable): mechanism = models.PositiveSmallIntegerField( choices=INJURY_MECHANISM_CHOICE, verbose_name="Injury mechanism" ) + diagnosis = models.TextField( + null=True, + blank=True, + verbose_name="Diagnosis", + help_text="Only normal text is authorized", + ) nb_week_off = models.SmallIntegerField( blank=True, null=True, verbose_name="# week off" ) @@ -206,10 +212,10 @@ class Injury(Markdownizable, Seasonisable): updated_at = models.DateTimeField(auto_now=True) def __str__(self): - return f"{self.gymnast} ({self.date})" + return f"{self.gymnast} ({self.date}): {self.mechanism} on {self.location} {self.body_side}" def timeline_representation(self): - return f"
(1: Very Bad - 10: Very Good)
+(1: Very Bad - 10: Very Good)
+(1: Very Low - 10: Very High)
+(1: Very Low - 10: Very High)
+(1: Very Low - 10: Very High)
+
{{ last_season_information.club.name }}
- {{ last_season_information.get_category_display }}
+ {{ gymnast.birthdate.year }} - {{ last_season_information.get_category_display }}
{{ gymnast.to_markdown | safe }}
@@ -45,7 +46,7 @@ 10 | : {% if best_straightjump %}{{ best_straightjump.0.tof }} ({{ best_straightjump.0.date | date:"d-m-Y" }}){% else %} (no information){% endif %}