diff --git a/jarvis/followup/admin.py b/jarvis/followup/admin.py index 5487722..ebbb497 100644 --- a/jarvis/followup/admin.py +++ b/jarvis/followup/admin.py @@ -121,21 +121,14 @@ class InjuryAdmin(admin.ModelAdmin): "mechanism", "nb_week_off", "informations", - ) + ) # educative readonly_fields = ("season", "week_number", "created_at", "updated_at") - list_display = ( - "date", - "gymnast", - "mechanism", - "location", - "body_side", - "nb_week_off", - ) + list_display = ("date", "gymnast", "skill") # educative 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 a4c8393..79cfdd3 100644 --- a/jarvis/followup/forms.py +++ b/jarvis/followup/forms.py @@ -192,7 +192,6 @@ class InjuryForm(forms.ModelForm): "location", "body_side", "nb_week_off", - "diagnosis", "informations", ) widgets = { @@ -212,16 +211,10 @@ 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: consequencies, re-education exercices, …", # pylint: disable=line-too-long + "placeholder": "Informations about injury: context (why, where, …), 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 d901d06..c54285b 100644 --- a/jarvis/followup/migrations/0052_injury_location.py +++ b/jarvis/followup/migrations/0052_injury_location.py @@ -15,6 +15,7 @@ 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", @@ -23,5 +24,6 @@ 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 deleted file mode 100644 index e16777a..0000000 --- a/jarvis/followup/migrations/0056_alter_injury_location.py +++ /dev/null @@ -1,24 +0,0 @@ -# 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 deleted file mode 100644 index 1746ac9..0000000 --- a/jarvis/followup/migrations/0057_injury_diagnosis.py +++ /dev/null @@ -1,23 +0,0 @@ -# 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 ff27f4c..d04d619 100644 --- a/jarvis/followup/models.py +++ b/jarvis/followup/models.py @@ -223,12 +223,6 @@ 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" ) @@ -236,10 +230,10 @@ class Injury(Markdownizable, Seasonisable): updated_at = models.DateTimeField(auto_now=True) def __str__(self): - return f"{self.gymnast} ({self.date}): {self.mechanism} on {self.location} {self.body_side}" + return f"{self.gymnast} ({self.date})" 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 }}
- {{ gymnast.birthdate.year }} - {{ last_season_information.get_category_display }}
+ {{ last_season_information.get_category_display }}
{{ gymnast.to_markdown | safe }}
@@ -46,7 +45,7 @@ 10 | : {% if best_straightjump %}{{ best_straightjump.0.tof }} ({{ best_straightjump.0.date | date:"d-m-Y" }}){% else %} (no information){% endif %}