khana/khana/objective/forms.py

64 lines
2.0 KiB
Python

# coding=UTF-8
from django import forms
from datetime import date
from .models import Routine, RoutineSkill, Chrono
class RoutineForm(forms.ModelForm):
class Meta:
model = Routine
fields = ("label", "label", "difficulty", "level", "active")
widgets = {
# Champs obligatoires de la classe mère.
"label": forms.TextInput(
attrs={"class": "form-control", "placeholder": "Routine's long name"}
),
"label": forms.TextInput(
attrs={"class": "form-control", "placeholder": "Routine's short name"}
),
"difficulty": forms.HiddenInput(),
"level": forms.HiddenInput(),
"active": forms.HiddenInput(),
}
class ChronoForm(forms.ModelForm):
class Meta:
model = Chrono
fields = ("routine", "routine_type", "gymnast", "date", "score")
widgets = {
"gymnast": forms.HiddenInput(),
"routine": forms.HiddenInput(),
"routine_type": forms.Select(attrs={"class": "form-control"}),
"date": forms.TextInput(
attrs={
"class": "form-control datepicker",
"placeholder": date.today().strftime("%Y-%m-%d"),
"value": date.today().strftime("%Y-%m-%d"),
}
),
"score": forms.TextInput(
attrs={"class": "form-control", "placeholder": "xx,xx"}
),
}
gymnast_related = forms.CharField(
widget=forms.TextInput(
attrs={
"class": "form-control",
"placeholder": "Searching gymnast…",
"data-ref": "#id_gymnast",
}
)
)
routine_related = forms.CharField(
widget=forms.TextInput(
attrs={
"class": "form-control",
"placeholder": "Searching routine…",
"data-ref": "#id_routine",
}
)
)