2021-12-19 09:30:51 +01:00
|
|
|
"""Formulaires de gestion des données entrantes pour les gymnastes et accidents."""
|
2021-12-09 16:53:44 +01:00
|
|
|
|
|
|
|
from django import forms
|
2022-02-06 15:44:55 +01:00
|
|
|
from django.contrib.auth import get_user_model
|
2021-12-09 16:53:44 +01:00
|
|
|
|
2021-12-19 09:30:51 +01:00
|
|
|
from .models import Gymnast
|
2021-12-09 16:53:44 +01:00
|
|
|
|
2022-02-06 15:44:55 +01:00
|
|
|
User = get_user_model()
|
|
|
|
|
2021-12-09 16:53:44 +01:00
|
|
|
|
2021-12-19 09:30:51 +01:00
|
|
|
class GymnastForm(forms.ModelForm):
|
2021-12-09 16:53:44 +01:00
|
|
|
class Meta:
|
|
|
|
model = Gymnast
|
|
|
|
fields = (
|
2021-12-19 09:30:51 +01:00
|
|
|
"last_name",
|
|
|
|
"first_name",
|
|
|
|
"birthdate",
|
|
|
|
"gender",
|
|
|
|
"is_active",
|
|
|
|
"club",
|
2022-09-08 08:55:36 +02:00
|
|
|
"email_trainer",
|
2021-12-19 09:30:51 +01:00
|
|
|
"trainings_by_week",
|
|
|
|
"hours_by_week",
|
2022-02-13 15:33:46 +01:00
|
|
|
"informations",
|
2021-12-09 16:53:44 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
widgets = {
|
2021-12-19 09:30:51 +01:00
|
|
|
"last_name": forms.TextInput(
|
|
|
|
attrs={"class": "form-control", "placeholder": "Lastname"}
|
2021-12-09 16:53:44 +01:00
|
|
|
),
|
2021-12-19 09:30:51 +01:00
|
|
|
"first_name": forms.TextInput(
|
|
|
|
attrs={"class": "form-control", "placeholder": "Firstname"}
|
2021-12-09 16:53:44 +01:00
|
|
|
),
|
2021-12-19 09:30:51 +01:00
|
|
|
"birthdate": forms.DateInput(attrs={"class": "form-control datepicker"}),
|
2022-01-06 17:59:21 +01:00
|
|
|
"gender": forms.Select(attrs={"class": "form-control selectpicker"}),
|
2021-12-19 09:30:51 +01:00
|
|
|
"club": forms.HiddenInput(),
|
2022-09-08 08:55:36 +02:00
|
|
|
"email_trainer": forms.TextInput(
|
|
|
|
attrs={"class": "form-control", "placeholder": "trainer_email@email.com"}
|
|
|
|
),
|
2021-12-19 09:30:51 +01:00
|
|
|
"trainings_by_week": forms.TextInput(
|
|
|
|
attrs={"class": "form-control", "placeholder": "5"}
|
2021-12-09 16:53:44 +01:00
|
|
|
),
|
2021-12-19 09:30:51 +01:00
|
|
|
"hours_by_week": forms.TextInput(
|
|
|
|
attrs={"class": "form-control", "placeholder": "11,5"}
|
2021-12-09 16:53:44 +01:00
|
|
|
),
|
2022-01-05 18:44:15 +01:00
|
|
|
"is_active": forms.CheckboxInput(
|
|
|
|
attrs={"class": "form-control form-check-input ml-0 mt-0"}
|
2022-02-13 15:33:46 +01:00
|
|
|
),
|
|
|
|
"informations": forms.Textarea(
|
|
|
|
attrs={
|
|
|
|
"class": "form-control",
|
|
|
|
"placeholder": "Informations about gymnast: fear, lost skill syndrom, …", # pylint: disable=line-too-long
|
|
|
|
}
|
|
|
|
),
|
2021-12-09 16:53:44 +01:00
|
|
|
}
|
|
|
|
|
2022-02-06 15:44:55 +01:00
|
|
|
last_name = forms.CharField(
|
|
|
|
widget=forms.TextInput(
|
|
|
|
attrs={"class": "form-control", "placeholder": "Lastname"}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
first_name = forms.CharField(
|
|
|
|
widget=forms.TextInput(
|
|
|
|
attrs={"class": "form-control", "placeholder": "Firstname"}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
email = forms.EmailField(
|
|
|
|
required=False,
|
|
|
|
widget=forms.TextInput(
|
|
|
|
attrs={"class": "form-control", "placeholder": "my_email@email.com"}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2021-12-09 16:53:44 +01:00
|
|
|
club_related = forms.CharField(
|
2022-02-06 17:39:26 +01:00
|
|
|
required=False,
|
2021-12-09 16:53:44 +01:00
|
|
|
widget=forms.TextInput(
|
|
|
|
attrs={
|
2021-12-19 09:30:51 +01:00
|
|
|
"class": "form-control",
|
|
|
|
"placeholder": "Searching club…",
|
|
|
|
"data-ref": "#id_club",
|
2021-12-09 16:53:44 +01:00
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
2022-02-06 15:44:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
class UserForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = User
|
|
|
|
fields = (
|
|
|
|
"last_name",
|
|
|
|
"first_name",
|
|
|
|
"email",
|
|
|
|
"is_active",
|
|
|
|
"username",
|
|
|
|
)
|