From e1976a0d85076fba16559170c3f1516800f87e79 Mon Sep 17 00:00:00 2001 From: Gregory Trullemans Date: Wed, 11 Oct 2023 13:23:17 +0200 Subject: [PATCH] Remove InjuryType model --- jarvis/followup/admin.py | 10 ---------- jarvis/followup/models.py | 41 +++++++++++++++++---------------------- 2 files changed, 18 insertions(+), 33 deletions(-) diff --git a/jarvis/followup/admin.py b/jarvis/followup/admin.py index ebbb497..ad4f16a 100644 --- a/jarvis/followup/admin.py +++ b/jarvis/followup/admin.py @@ -14,7 +14,6 @@ from .models import ( Injury, WellBeing, Intensity, - InjuryType, HeightWeight, LearnedSkill, ChronoDetails, @@ -101,14 +100,6 @@ class InjuryLocationAdmin(admin.ModelAdmin): search_fields = ("label",) -class InjuryTypeAdmin(admin.ModelAdmin): - model = InjuryType - - list_display = ("label",) - fields = ("label",) - search_fields = ("label",) - - class InjuryAdmin(admin.ModelAdmin): model = Injury @@ -309,7 +300,6 @@ admin.site.register(Chrono, ChronoAdmin) admin.site.register(Injury, InjuryAdmin) admin.site.register(WellBeing, WellBeingAdmin) admin.site.register(Intensity, IntensityAdmin) -admin.site.register(InjuryType, InjuryTypeAdmin) admin.site.register(LearnedSkill, LearnedSkillAdmin) admin.site.register(HeightWeight, HeightWeightAdmin) admin.site.register(ChronoDetails, ChronoDetailsAdmin) diff --git a/jarvis/followup/models.py b/jarvis/followup/models.py index d04d619..ee7ad0a 100644 --- a/jarvis/followup/models.py +++ b/jarvis/followup/models.py @@ -23,6 +23,22 @@ INJURY_BODY_SIDE_CHOICE = ( (3, "Both"), ) +INJURY_TYPE_CHOICE = ( + (0, "Abrasion"), + (1, "Dental Injury"), + (2, "Dislocation / Subluxation"), + (3, "Fracture"), + (4, "Haematoma / Contusion / Bruise"), + (5, "Head Concussion"), + (6, "Laceration"), + (7, "Lesion of Meniscus or Cartilage"), + (8, "Muscle Rupture /Strain / Tear / Cramps"), + (9, "Nerve Injury"), + (10, "Other Bone Injury"), + (11, "Sprain / Ligament Injury"), + (12, "Tendon Injury / Rupture / Tendinosis / Bursitis"), +) + ROUTINE_TYPE_CHOICE = ( (0, "Other"), (1, "Q1R1"), @@ -161,21 +177,6 @@ class InjuryLocation(models.Model): return f"{self.label}" -class InjuryType(models.Model): - """ - Classe représentant les types de blessures - """ - - class Meta: - verbose_name = "Injury Type" - verbose_name_plural = "Injury Types" - - label = models.CharField(max_length=100, null=False, blank=False) - - def __str__(self): - return f"{self.label}" - - class Injury(Markdownizable, Seasonisable): """ La classe `Injury` permet d'indiquer qu'un gymnaste a eu un blessure, en liaison avec un @@ -208,14 +209,8 @@ class Injury(Markdownizable, Seasonisable): related_name="injuries", on_delete=models.CASCADE, ) - injury_type = models.ForeignKey( - InjuryType, - verbose_name="Injury Type", - related_name="injuries", - on_delete=models.SET_NULL, - default=None, - blank=True, - null=True, + injury_type = models.SmallIntegerField( + choices=INJURY_TYPE_CHOICE, verbose_name="Injury type" ) body_side = models.PositiveSmallIntegerField( choices=INJURY_BODY_SIDE_CHOICE, verbose_name="Body side"