Remove InjuryType model

This commit is contained in:
Gregory Trullemans 2023-10-11 13:23:17 +02:00
parent 9eb5c9304e
commit e1976a0d85
2 changed files with 18 additions and 33 deletions

View File

@ -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)

View File

@ -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"