84 lines
2.5 KiB
Python
84 lines
2.5 KiB
Python
|
"""Formulaires de gestion des données entrantes pour les gymnastes et accidents."""
|
||
|
|
||
|
from django import forms
|
||
|
from django.contrib.auth import get_user_model
|
||
|
|
||
|
from .models import Gymnast
|
||
|
|
||
|
User = get_user_model()
|
||
|
|
||
|
|
||
|
class GymnastForm(forms.ModelForm):
|
||
|
class Meta:
|
||
|
model = Gymnast
|
||
|
fields = (
|
||
|
"last_name",
|
||
|
"first_name",
|
||
|
"birthdate",
|
||
|
"gender",
|
||
|
"is_active",
|
||
|
"orientation",
|
||
|
"year_of_practice",
|
||
|
"email_trainer",
|
||
|
"informations",
|
||
|
)
|
||
|
|
||
|
widgets = {
|
||
|
"last_name": forms.TextInput(
|
||
|
attrs={"class": "form-control", "placeholder": "Lastname"}
|
||
|
),
|
||
|
"first_name": forms.TextInput(
|
||
|
attrs={"class": "form-control", "placeholder": "Firstname"}
|
||
|
),
|
||
|
"birthdate": forms.DateInput(attrs={"class": "form-control datepicker"}),
|
||
|
"gender": forms.Select(attrs={"class": "form-control selectpicker"}),
|
||
|
"email_trainer": forms.TextInput(
|
||
|
attrs={
|
||
|
"class": "form-control",
|
||
|
"placeholder": "trainer_email@email.com",
|
||
|
}
|
||
|
),
|
||
|
"is_active": forms.CheckboxInput(
|
||
|
attrs={"class": "form-control form-check-input ml-0 mt-0"}
|
||
|
),
|
||
|
"orientation": forms.Select(attrs={"class": "form-control selectpicker"}),
|
||
|
"year_of_practice": forms.TextInput(
|
||
|
attrs={"class": "form-control", "placeholder": "3"}
|
||
|
),
|
||
|
"informations": forms.Textarea(
|
||
|
attrs={
|
||
|
"class": "form-control",
|
||
|
"placeholder": "Informations about gymnast: fear, lost skill syndrom, …", # pylint: disable=line-too-long
|
||
|
}
|
||
|
),
|
||
|
}
|
||
|
|
||
|
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"}
|
||
|
),
|
||
|
)
|
||
|
|
||
|
|
||
|
class UserForm(forms.ModelForm):
|
||
|
class Meta:
|
||
|
model = User
|
||
|
fields = (
|
||
|
"last_name",
|
||
|
"first_name",
|
||
|
"email",
|
||
|
"is_active",
|
||
|
"username",
|
||
|
)
|