from datetime import date from django import forms from .models import ( Plan, Note, Point, Chrono, Accident, MindState, Intensity, HeightWeight, LearnedSkill, GymnastHasRoutine, SeasonInformation, NumberOfRoutineDone, ) class ChronoForm(forms.ModelForm): class Meta: model = Chrono fields = ("gymnast", "date", "chrono_type", "score_type", "score", "tof") widgets = { "gymnast": forms.HiddenInput(), "date": forms.TextInput( attrs={ "class": "form-control datepicker", "placeholder": date.today().strftime("%Y-%m-%d"), "value": date.today().strftime("%Y-%m-%d"), } ), "chrono_type": forms.Select(attrs={"class": "form-control selectpicker"}), "score_type": forms.Select(attrs={"class": "form-control selectpicker"}), "score": forms.TextInput( attrs={ "class": "form-control", "placeholder": "xx,xxx", "min": "0.01", "step": "0.01", } ), "tof": forms.HiddenInput(), } gymnast_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching gymnast…", "data-ref": "#id_gymnast", } ), ) class LearnedSkillForm(forms.ModelForm): class Meta: model = LearnedSkill fields = ("gymnast", "skill", "learning_step", "date") widgets = { "gymnast": forms.HiddenInput(), "skill": forms.HiddenInput(), "date": forms.TextInput( attrs={ "class": "form-control datepicker", "placeholder": date.today().strftime("%Y-%m-%d"), "value": date.today().strftime("%Y-%m-%d"), } ), "learning_step": forms.Select(attrs={"class": "form-control selectpicker"}), } gymnast_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching gymnast…", "data-ref": "#id_gymnast", } ), ) skill_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching skill…", "data-ref": "#id_skill", } ), ) class ScoreForm(forms.ModelForm): class Meta: ROUTINETYPE_CHOICE = ( (0, "Routine 1"), (1, "Routine 2"), (2, "Final's routine"), ) model = Point fields = ( "gymnast", "event", "routine_type", "point_difficulty", "point_time_of_flight", "point_execution", "point_horizontal_displacement", "penality", "total", ) widgets = { "gymnast": forms.HiddenInput(), "event": forms.HiddenInput(), "routine_type": forms.Select(attrs={"class": "form-control selectpicker"}), "point_execution": forms.NumberInput( attrs={"class": "form-control", "placeholder": "xx,xx", "min": "0"} ), "point_difficulty": forms.NumberInput( attrs={"class": "form-control", "placeholder": "xx,xx", "min": "0"} ), "point_time_of_flight": forms.NumberInput( attrs={"class": "form-control", "placeholder": "xx,xx", "min": "0"} ), "point_horizontal_displacement": forms.NumberInput( attrs={"class": "form-control", "placeholder": "x,xx", "min": "0"} ), "penality": forms.NumberInput( attrs={ "class": "form-control", "placeholder": "xx,xx", "value": "0", "min": "0", } ), "total": forms.TextInput( attrs={ "class": "form-control", "placeholder": "000,000", "readonly": "readonly", "maxlength": "6", } ), } gymnast_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching…", "data-ref": "#id_gymnast", } ), ) event_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching…", "data-ref": "#id_event", } ), ) add_to_chrono = forms.NullBooleanField( required=False, widget=forms.CheckboxInput( attrs={"class": "form-control form-check-input ml-0 mt-0"} ), ) class AccidentForm(forms.ModelForm): class Meta: model = Accident fields = ("gymnast", "date", "nb_week_off", "informations") widgets = { "date": forms.DateInput( attrs={ "class": "form-control datepicker", "placeholder": date.today().strftime("%Y-%m-%d"), "value": date.today().strftime("%Y-%m-%d"), } ), "gymnast": forms.HiddenInput(), "skill": forms.HiddenInput(), "nb_week_off": forms.NumberInput( attrs={"class": "form-control", "placeholder": "xx"} ), "informations": forms.Textarea( attrs={ "class": "form-control", "placeholder": "Informations about accident: context (why, where, …), consequencies, re-education exercices, …", # pylint: disable=line-too-long } ), } gymnast_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching gymnast…", "data-ref": "#id_gymnast", } ), ) skill_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching skill…", "data-ref": "#id_skill", } ), ) class MindStateForm(forms.ModelForm): class Meta: model = MindState fields = ("gymnast", "date", "score", "informations") widgets = { "gymnast": forms.HiddenInput(), "date": forms.TextInput( attrs={ "class": "form-control datepicker", "placeholder": date.today().strftime("%Y-%m-%d"), "value": date.today().strftime("%Y-%m-%d"), } ), "event": forms.HiddenInput(), "score": forms.NumberInput( attrs={ "class": "form-control", "placeholder": "x", "min": "0", "max": "10", } ), "informations": forms.Textarea( attrs={ "class": "form-control", "placeholder": "Informations about the psychological state of mind : context (why, where, …), possible consequencies, …", # pylint: disable=line-too-long } ), } gymnast_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching gymnast…", "data-ref": "#id_gymnast", } ), ) event_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching event…", "data-ref": "#id_event", } ), ) class GymnastHasRoutineForm(forms.ModelForm): class Meta: model = GymnastHasRoutine fields = ("gymnast", "routine", "routine_type", "date_begin", "date_end") widgets = { "gymnast": forms.HiddenInput(), "routine": forms.HiddenInput(), "routine_type": forms.Select(attrs={"class": "form-control selectpicker"}), "date_begin": forms.DateInput( attrs={ "class": "form-control datepicker", } ), "date_end": forms.DateInput( attrs={ "class": "form-control datepicker", } ), } gymnast_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching gymnast…", "data-ref": "#id_gymnast", } ), ) routine_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching routine…", "data-ref": "#id_routine", } ), ) class HeightWeightForm(forms.ModelForm): """ Formulaire d'enregistrement d'un couple taille/poids """ class Meta: model = HeightWeight fields = ("gymnast", "date", "height", "hips_height", "weight") widgets = { "gymnast": forms.HiddenInput(), "date": forms.TextInput( attrs={ "class": "form-control datepicker", "placeholder": date.today().strftime("%Y-%m-%d"), "value": date.today().strftime("%Y-%m-%d"), } ), "height": forms.NumberInput( attrs={ "class": "form-control", "placeholder": "xxx,x", "min": "100", "max": "220", } ), "hips_height": forms.NumberInput( attrs={ "class": "form-control", "placeholder": "xxx,x", "min": "50", "max": "110", } ), "weight": forms.NumberInput( attrs={ "class": "form-control", "placeholder": "xxx,x", "min": "20", "max": "110", } ), } gymnast_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching gymnast…", "data-ref": "#id_gymnast", } ), ) class NumberOfRoutineDoneForm(forms.ModelForm): class Meta: model = NumberOfRoutineDone fields = ( "gymnast", "routine", "routine_type", "date", "number_of_try", "number_of_successes", ) widgets = { "gymnast": forms.HiddenInput(), "routine": forms.HiddenInput(), "routine_type": forms.Select(attrs={"class": "form-control selectpicker"}), "date": forms.DateInput( attrs={ "class": "form-control datepicker", } ), "number_of_try": forms.NumberInput( attrs={ "class": "form-control", "placeholder": "x", "min": "0", "max": "50", } ), "number_of_successes": forms.NumberInput( attrs={ "class": "form-control", "placeholder": "x", "min": "0", "max": "50", } ), } gymnast_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching gymnast…", "data-ref": "#id_gymnast", } ), ) routine_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching routine…", "data-ref": "#id_routine", } ), ) class PlanForm(forms.ModelForm): """ Formulaire d'enregistrement d'un plan (gymnast qui doit faire un eductative pour une date X) """ class Meta: model = Plan fields = ( "date", "gymnast", "educative", "learning_step", "is_done", "informations", ) widgets = { "gymnast": forms.HiddenInput(), "educative": forms.HiddenInput(), "date": forms.TextInput( attrs={ "class": "form-control datepicker", "placeholder": date.today().strftime("%Y-%m-%d"), "value": date.today().strftime("%Y-%m-%d"), } ), "learning_step": forms.Select(attrs={"class": "form-control selectpicker"}), "is_done": forms.CheckboxInput( attrs={"class": "form-control form-check-input ml-0 mt-0"} ), "informations": forms.Textarea( attrs={ "class": "form-control", "placeholder": "Informations about gymnast for this particular skill: usual mistake, fear, …", # pylint: disable=line-too-long } ), } gymnast_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching gymnast…", "data-ref": "#id_gymnast", } ), ) educative_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching skill…", "data-ref": "#id_skill", } ), ) class NoteForm(forms.ModelForm): class Meta: model = Note fields = ("gymnast", "coach", "status", "informations", "date") widgets = { "gymnast": forms.HiddenInput(), "coach": forms.HiddenInput(), "status": forms.Select(attrs={"class": "form-control selectpicker"}), "date": forms.TextInput( attrs={ "class": "form-control datepicker", "placeholder": date.today().strftime("%Y-%m-%d"), "value": date.today().strftime("%Y-%m-%d"), } ), "informations": forms.Textarea( attrs={ "class": "form-control", "placeholder": "Informations about gymnast: fear, lost skill syndrom, …", # pylint: disable=line-too-long } ), } gymnast_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching gymnast…", "data-ref": "#id_gymnast", } ), ) class IntensityForm(forms.ModelForm): class Meta: model = Intensity fields = ( "gymnast", "time", "difficulty", "quantity_of_skill", "number_of_passes", "informations", "date", ) widgets = { "gymnast": forms.HiddenInput(), "time": forms.NumberInput( attrs={ "class": "form-control", "placeholder": "xxx", } ), "difficulty": forms.NumberInput( attrs={ "class": "form-control", "placeholder": "xxx", } ), "quantity_of_skill": forms.NumberInput( attrs={ "class": "form-control", "placeholder": "xxx", } ), "number_of_passes": forms.NumberInput( attrs={ "class": "form-control", "placeholder": "xxx", } ), "date": forms.TextInput( attrs={ "class": "form-control datepicker", "placeholder": date.today().strftime("%Y-%m-%d"), "value": date.today().strftime("%Y-%m-%d"), } ), "informations": forms.Textarea( attrs={ "class": "form-control", "placeholder": "Informations about intensity: did you do your full program, did you stop before the end, why did you stop before the end, …", # pylint: disable=line-too-long } ), } gymnast_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching gymnast…", "data-ref": "#id_gymnast", } ), ) class SeasonInformationForm(forms.ModelForm): class Meta: model = SeasonInformation fields = ( "gymnast", "season", "number_of_training_sessions_per_week", "number_of_hours_per_week", "number_of_s_and_c_sessions_per_week", "number_of_s_and_c_hours_per_week", "category", "club", ) widgets = { "gymnast": forms.HiddenInput(), "season": forms.TextInput( attrs={"class": "form-control", "placeholder": "202x-202y"} ), "number_of_training_sessions_per_week": forms.TextInput( attrs={"class": "form-control", "placeholder": "5"} ), "number_of_hours_per_week": forms.TextInput( attrs={"class": "form-control", "placeholder": "11.5"} ), "number_of_s_and_c_sessions_per_week": forms.TextInput( attrs={"class": "form-control", "placeholder": "5"} ), "number_of_s_and_c_hours_per_week": forms.TextInput( attrs={"class": "form-control", "placeholder": "11.5"} ), "category": forms.Select(attrs={"class": "form-control selectpicker"}), "club": forms.HiddenInput(), } club_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching club…", "data-ref": "#id_club", } ), ) gymnast_related = forms.CharField( required=False, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": "Searching gymnast…", "data-ref": "#id_gymnast", } ), )