Remove Injury and InjuryLocation models
This commit is contained in:
parent
104a4255cf
commit
8635941d39
|
@ -11,13 +11,13 @@ from .models import (
|
||||||
Note,
|
Note,
|
||||||
Point,
|
Point,
|
||||||
Chrono,
|
Chrono,
|
||||||
Injury,
|
# Injury,
|
||||||
WellBeing,
|
WellBeing,
|
||||||
Intensity,
|
Intensity,
|
||||||
HeightWeight,
|
HeightWeight,
|
||||||
LearnedSkill,
|
LearnedSkill,
|
||||||
ChronoDetails,
|
ChronoDetails,
|
||||||
InjuryLocation,
|
# InjuryLocation,
|
||||||
GymnastHasRoutine,
|
GymnastHasRoutine,
|
||||||
SeasonInformation,
|
SeasonInformation,
|
||||||
NumberOfRoutineDone,
|
NumberOfRoutineDone,
|
||||||
|
@ -91,38 +91,38 @@ class PointAdmin(admin.ModelAdmin):
|
||||||
autocomplete_fields = ("gymnast", "event")
|
autocomplete_fields = ("gymnast", "event")
|
||||||
|
|
||||||
|
|
||||||
class InjuryLocationAdmin(admin.ModelAdmin):
|
# class InjuryLocationAdmin(admin.ModelAdmin):
|
||||||
model = InjuryLocation
|
# model = InjuryLocation
|
||||||
|
|
||||||
list_display = ("label",)
|
# list_display = ("label",)
|
||||||
fields = ("label",)
|
# fields = ("label",)
|
||||||
search_fields = ("label",)
|
# search_fields = ("label",)
|
||||||
|
|
||||||
|
|
||||||
class InjuryAdmin(admin.ModelAdmin):
|
# class InjuryAdmin(admin.ModelAdmin):
|
||||||
model = Injury
|
# model = Injury
|
||||||
|
|
||||||
fields = (
|
# fields = (
|
||||||
"date",
|
# "date",
|
||||||
"gymnast",
|
# "gymnast",
|
||||||
"skill",
|
# "skill",
|
||||||
"location",
|
# "location",
|
||||||
"body_side",
|
# "body_side",
|
||||||
"mechanism",
|
# "mechanism",
|
||||||
"nb_week_off",
|
# "nb_week_off",
|
||||||
"informations",
|
# "informations",
|
||||||
) # educative
|
# ) # educative
|
||||||
readonly_fields = ("season", "week_number", "created_at", "updated_at")
|
# readonly_fields = ("season", "week_number", "created_at", "updated_at")
|
||||||
list_display = ("date", "gymnast", "skill") # educative
|
# list_display = ("date", "gymnast", "skill") # educative
|
||||||
list_filter = (
|
# list_filter = (
|
||||||
("gymnast", RelatedDropdownFilter),
|
# ("gymnast", RelatedDropdownFilter),
|
||||||
("location", RelatedDropdownFilter),
|
# ("location", RelatedDropdownFilter),
|
||||||
("body_side", DropdownFilter),
|
# ("body_side", DropdownFilter),
|
||||||
("mechanism", DropdownFilter),
|
# ("mechanism", DropdownFilter),
|
||||||
)
|
# )
|
||||||
date_hierarchy = "date"
|
# date_hierarchy = "date"
|
||||||
search_fields = ("date", "gymnast") # educative
|
# search_fields = ("date", "gymnast") # educative
|
||||||
autocomplete_fields = ("gymnast", "skill")
|
# autocomplete_fields = ("gymnast", "skill")
|
||||||
|
|
||||||
|
|
||||||
class WellBeingAdmin(admin.ModelAdmin):
|
class WellBeingAdmin(admin.ModelAdmin):
|
||||||
|
@ -298,13 +298,13 @@ admin.site.register(Plan, PlanAdmin)
|
||||||
admin.site.register(Note, NoteAdmin)
|
admin.site.register(Note, NoteAdmin)
|
||||||
admin.site.register(Point, PointAdmin)
|
admin.site.register(Point, PointAdmin)
|
||||||
admin.site.register(Chrono, ChronoAdmin)
|
admin.site.register(Chrono, ChronoAdmin)
|
||||||
admin.site.register(Injury, InjuryAdmin)
|
# admin.site.register(Injury, InjuryAdmin)
|
||||||
admin.site.register(WellBeing, WellBeingAdmin)
|
admin.site.register(WellBeing, WellBeingAdmin)
|
||||||
admin.site.register(Intensity, IntensityAdmin)
|
admin.site.register(Intensity, IntensityAdmin)
|
||||||
admin.site.register(LearnedSkill, LearnedSkillAdmin)
|
admin.site.register(LearnedSkill, LearnedSkillAdmin)
|
||||||
admin.site.register(HeightWeight, HeightWeightAdmin)
|
admin.site.register(HeightWeight, HeightWeightAdmin)
|
||||||
admin.site.register(ChronoDetails, ChronoDetailsAdmin)
|
admin.site.register(ChronoDetails, ChronoDetailsAdmin)
|
||||||
admin.site.register(InjuryLocation, InjuryLocationAdmin)
|
# admin.site.register(InjuryLocation, InjuryLocationAdmin)
|
||||||
admin.site.register(SeasonInformation, SeasonInformationAdmin)
|
admin.site.register(SeasonInformation, SeasonInformationAdmin)
|
||||||
admin.site.register(GymnastHasRoutine, GymnastHasRoutineAdmin)
|
admin.site.register(GymnastHasRoutine, GymnastHasRoutineAdmin)
|
||||||
admin.site.register(NumberOfRoutineDone, NumberOfRoutineDoneAdmin)
|
admin.site.register(NumberOfRoutineDone, NumberOfRoutineDoneAdmin)
|
||||||
|
|
|
@ -7,7 +7,7 @@ from .models import (
|
||||||
Note,
|
Note,
|
||||||
Point,
|
Point,
|
||||||
Chrono,
|
Chrono,
|
||||||
Injury,
|
# Injury,
|
||||||
WellBeing,
|
WellBeing,
|
||||||
Intensity,
|
Intensity,
|
||||||
HeightWeight,
|
HeightWeight,
|
||||||
|
@ -181,65 +181,65 @@ class ScoreForm(forms.ModelForm):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class InjuryForm(forms.ModelForm):
|
# class InjuryForm(forms.ModelForm):
|
||||||
class Meta:
|
# class Meta:
|
||||||
model = Injury
|
# model = Injury
|
||||||
fields = (
|
# fields = (
|
||||||
"gymnast",
|
# "gymnast",
|
||||||
"date",
|
# "date",
|
||||||
"mechanism",
|
# "mechanism",
|
||||||
"injury_type",
|
# "injury_type",
|
||||||
"location",
|
# "location",
|
||||||
"body_side",
|
# "body_side",
|
||||||
"nb_week_off",
|
# "nb_week_off",
|
||||||
"informations",
|
# "informations",
|
||||||
)
|
# )
|
||||||
widgets = {
|
# widgets = {
|
||||||
"date": forms.DateInput(
|
# "date": forms.DateInput(
|
||||||
attrs={
|
# attrs={
|
||||||
"class": "form-control datepicker",
|
# "class": "form-control datepicker",
|
||||||
"placeholder": date.today().strftime("%Y-%m-%d"),
|
# "placeholder": date.today().strftime("%Y-%m-%d"),
|
||||||
"value": date.today().strftime("%Y-%m-%d"),
|
# "value": date.today().strftime("%Y-%m-%d"),
|
||||||
}
|
# }
|
||||||
),
|
# ),
|
||||||
"gymnast": forms.HiddenInput(),
|
# "gymnast": forms.HiddenInput(),
|
||||||
"skill": forms.HiddenInput(),
|
# "skill": forms.HiddenInput(),
|
||||||
"injury_type": forms.Select(attrs={"class": "form-control selectpicker"}),
|
# "injury_type": forms.Select(attrs={"class": "form-control selectpicker"}),
|
||||||
"mechanism": forms.Select(attrs={"class": "form-control selectpicker"}),
|
# "mechanism": forms.Select(attrs={"class": "form-control selectpicker"}),
|
||||||
"location": forms.Select(attrs={"class": "form-control selectpicker"}),
|
# "location": forms.Select(attrs={"class": "form-control selectpicker"}),
|
||||||
"body_side": forms.Select(attrs={"class": "form-control selectpicker"}),
|
# "body_side": forms.Select(attrs={"class": "form-control selectpicker"}),
|
||||||
"nb_week_off": forms.NumberInput(
|
# "nb_week_off": forms.NumberInput(
|
||||||
attrs={"class": "form-control", "placeholder": "xx"}
|
# attrs={"class": "form-control", "placeholder": "xx"}
|
||||||
),
|
# ),
|
||||||
"informations": forms.Textarea(
|
# "informations": forms.Textarea(
|
||||||
attrs={
|
# attrs={
|
||||||
"class": "form-control",
|
# "class": "form-control",
|
||||||
"placeholder": "Informations about injury: context (why, where, …), 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
|
||||||
}
|
# }
|
||||||
),
|
# ),
|
||||||
}
|
# }
|
||||||
|
|
||||||
gymnast_related = forms.CharField(
|
# gymnast_related = forms.CharField(
|
||||||
required=False,
|
# required=False,
|
||||||
widget=forms.TextInput(
|
# widget=forms.TextInput(
|
||||||
attrs={
|
# attrs={
|
||||||
"class": "form-control",
|
# "class": "form-control",
|
||||||
"placeholder": "Searching gymnast…",
|
# "placeholder": "Searching gymnast…",
|
||||||
"data-ref": "#id_gymnast",
|
# "data-ref": "#id_gymnast",
|
||||||
}
|
# }
|
||||||
),
|
# ),
|
||||||
)
|
# )
|
||||||
|
|
||||||
skill_related = forms.CharField(
|
# skill_related = forms.CharField(
|
||||||
required=False,
|
# required=False,
|
||||||
widget=forms.TextInput(
|
# widget=forms.TextInput(
|
||||||
attrs={
|
# attrs={
|
||||||
"class": "form-control",
|
# "class": "form-control",
|
||||||
"placeholder": "Searching skill…",
|
# "placeholder": "Searching skill…",
|
||||||
"data-ref": "#id_skill",
|
# "data-ref": "#id_skill",
|
||||||
}
|
# }
|
||||||
),
|
# ),
|
||||||
)
|
# )
|
||||||
|
|
||||||
|
|
||||||
class WellBeingForm(forms.ModelForm):
|
class WellBeingForm(forms.ModelForm):
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 4.2 on 2023-10-11 12:56
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("followup", "0060_alter_injury_injury_type_alter_injury_location_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name="Injury",
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name="InjuryLocation",
|
||||||
|
),
|
||||||
|
]
|
|
@ -162,73 +162,73 @@ class ChronoDetails(models.Model):
|
||||||
value = models.DecimalField(max_digits=5, decimal_places=3)
|
value = models.DecimalField(max_digits=5, decimal_places=3)
|
||||||
|
|
||||||
|
|
||||||
class InjuryLocation(models.Model):
|
# class InjuryLocation(models.Model):
|
||||||
"""
|
# """
|
||||||
Classe représentant les localisations de blessures
|
# Classe représentant les localisations de blessures
|
||||||
"""
|
# """
|
||||||
|
|
||||||
class Meta:
|
# class Meta:
|
||||||
verbose_name = "Injury Location"
|
# verbose_name = "Injury Location"
|
||||||
verbose_name_plural = "Injury Locations"
|
# verbose_name_plural = "Injury Locations"
|
||||||
|
|
||||||
label = models.CharField(max_length=100, null=False, blank=False)
|
# label = models.CharField(max_length=100, null=False, blank=False)
|
||||||
|
|
||||||
def __str__(self):
|
# def __str__(self):
|
||||||
return f"{self.label}"
|
# return f"{self.label}"
|
||||||
|
|
||||||
|
|
||||||
class Injury(Markdownizable, Seasonisable):
|
# class Injury(Markdownizable, Seasonisable):
|
||||||
"""
|
# """
|
||||||
La classe `Injury` permet d'indiquer qu'un gymnaste a eu un blessure, en liaison avec un
|
# La classe `Injury` permet d'indiquer qu'un gymnaste a eu un blessure, en liaison avec un
|
||||||
skill ou non.
|
# skill ou non.
|
||||||
"""
|
# """
|
||||||
|
|
||||||
class Meta:
|
# class Meta:
|
||||||
verbose_name = "Injury"
|
# verbose_name = "Injury"
|
||||||
verbose_name_plural = "Injuries"
|
# verbose_name_plural = "Injuries"
|
||||||
# unique_together = ("gymnast", "skill", "date")
|
# # unique_together = ("gymnast", "skill", "date")
|
||||||
|
|
||||||
gymnast = models.ForeignKey(
|
# gymnast = models.ForeignKey(
|
||||||
Gymnast,
|
# Gymnast,
|
||||||
verbose_name="Gymnast",
|
# verbose_name="Gymnast",
|
||||||
related_name="injuries",
|
# related_name="injuries",
|
||||||
on_delete=models.CASCADE,
|
# on_delete=models.CASCADE,
|
||||||
)
|
# )
|
||||||
skill = models.ForeignKey(
|
# skill = models.ForeignKey(
|
||||||
"objective.Skill",
|
# "objective.Skill",
|
||||||
verbose_name="Skill",
|
# verbose_name="Skill",
|
||||||
related_name="injuries",
|
# related_name="injuries",
|
||||||
on_delete=models.SET_NULL,
|
# on_delete=models.SET_NULL,
|
||||||
default=None,
|
# default=None,
|
||||||
blank=True,
|
# blank=True,
|
||||||
null=True,
|
# null=True,
|
||||||
)
|
# )
|
||||||
location = models.ForeignKey(
|
# location = models.ForeignKey(
|
||||||
InjuryLocation,
|
# InjuryLocation,
|
||||||
verbose_name="Location",
|
# verbose_name="Location",
|
||||||
related_name="injuries",
|
# related_name="injuries",
|
||||||
on_delete=models.CASCADE,
|
# on_delete=models.CASCADE,
|
||||||
)
|
# )
|
||||||
injury_type = models.SmallIntegerField(
|
# injury_type = models.SmallIntegerField(
|
||||||
choices=INJURY_TYPE_CHOICE, verbose_name="Injury type"
|
# choices=INJURY_TYPE_CHOICE, verbose_name="Injury type"
|
||||||
)
|
# )
|
||||||
body_side = models.PositiveSmallIntegerField(
|
# body_side = models.PositiveSmallIntegerField(
|
||||||
choices=INJURY_BODY_SIDE_CHOICE, verbose_name="Body side"
|
# choices=INJURY_BODY_SIDE_CHOICE, verbose_name="Body side"
|
||||||
)
|
# )
|
||||||
mechanism = models.PositiveSmallIntegerField(
|
# mechanism = models.PositiveSmallIntegerField(
|
||||||
choices=INJURY_MECHANISM_CHOICE, verbose_name="Injury mechanism"
|
# choices=INJURY_MECHANISM_CHOICE, verbose_name="Injury mechanism"
|
||||||
)
|
# )
|
||||||
nb_week_off = models.SmallIntegerField(
|
# nb_week_off = models.SmallIntegerField(
|
||||||
blank=True, null=True, verbose_name="# week off"
|
# blank=True, null=True, verbose_name="# week off"
|
||||||
)
|
# )
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
# created_at = models.DateTimeField(auto_now_add=True)
|
||||||
updated_at = models.DateTimeField(auto_now=True)
|
# updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
def __str__(self):
|
# def __str__(self):
|
||||||
return f"{self.gymnast} ({self.date})"
|
# return f"{self.gymnast} ({self.date})"
|
||||||
|
|
||||||
def timeline_representation(self):
|
# def timeline_representation(self):
|
||||||
return f"<li>{self.date:%d %b %Y} - Accident ({self.skill}): {self.nb_week_off} (weeks off)</li>"
|
# return f"<li>{self.date:%d %b %Y} - Accident ({self.skill}): {self.nb_week_off} (weeks off)</li>"
|
||||||
|
|
||||||
|
|
||||||
class LearnedSkill(Seasonisable):
|
class LearnedSkill(Seasonisable):
|
||||||
|
|
|
@ -19,7 +19,7 @@ from .models import (
|
||||||
Note,
|
Note,
|
||||||
Point,
|
Point,
|
||||||
Chrono,
|
Chrono,
|
||||||
Injury,
|
# Injury,
|
||||||
WellBeing,
|
WellBeing,
|
||||||
Intensity,
|
Intensity,
|
||||||
LearnedSkill,
|
LearnedSkill,
|
||||||
|
@ -35,7 +35,7 @@ from .forms import (
|
||||||
NoteForm,
|
NoteForm,
|
||||||
ScoreForm,
|
ScoreForm,
|
||||||
ChronoForm,
|
ChronoForm,
|
||||||
InjuryForm,
|
# InjuryForm,
|
||||||
WellBeingForm,
|
WellBeingForm,
|
||||||
IntensityForm,
|
IntensityForm,
|
||||||
HeightWeightForm,
|
HeightWeightForm,
|
||||||
|
|
|
@ -35,7 +35,7 @@ from jarvis.followup.models import (
|
||||||
Skill,
|
Skill,
|
||||||
Point,
|
Point,
|
||||||
Chrono,
|
Chrono,
|
||||||
Injury,
|
# Injury,
|
||||||
WellBeing,
|
WellBeing,
|
||||||
Intensity,
|
Intensity,
|
||||||
LearnedSkill,
|
LearnedSkill,
|
||||||
|
@ -287,7 +287,7 @@ def gymnast_display_injury(request, gymnast_id):
|
||||||
Args:
|
Args:
|
||||||
gymnast_id (int) identifiant du gymnast
|
gymnast_id (int) identifiant du gymnast
|
||||||
"""
|
"""
|
||||||
injuries_list = Injury.objects.filter(gymnast=gymnast_id)
|
injuries_list = None # Injury.objects.filter(gymnast=gymnast_id)
|
||||||
context = {"injuries_list": injuries_list, "gymnast_id": gymnast_id}
|
context = {"injuries_list": injuries_list, "gymnast_id": gymnast_id}
|
||||||
return render(request, "gymnasts/list_injury.html", context)
|
return render(request, "gymnasts/list_injury.html", context)
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ def gymnast_display_physiological(request, gymnast_id):
|
||||||
Args:
|
Args:
|
||||||
gymnast_id (int) identifiant du gymnast
|
gymnast_id (int) identifiant du gymnast
|
||||||
"""
|
"""
|
||||||
injuries_list = Injury.objects.filter(gymnast=gymnast_id).order_by("date")
|
injuries_list = None # Injury.objects.filter(gymnast=gymnast_id).order_by("date")
|
||||||
wellbeing_list = WellBeing.objects.filter(gymnast=gymnast_id).order_by("date")
|
wellbeing_list = WellBeing.objects.filter(gymnast=gymnast_id).order_by("date")
|
||||||
height_weight_list = HeightWeight.objects.filter(gymnast=gymnast_id).order_by(
|
height_weight_list = HeightWeight.objects.filter(gymnast=gymnast_id).order_by(
|
||||||
"date"
|
"date"
|
||||||
|
|
Loading…
Reference in New Issue