76 lines
2.2 KiB
Python
76 lines
2.2 KiB
Python
# coding=UTF-8
|
|
|
|
from django import forms
|
|
from datetime import date
|
|
from .models import Point
|
|
|
|
|
|
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"}),
|
|
"point_execution": forms.NumberInput(
|
|
attrs={"class": "form-control", "placeholder": "xx,xx",}
|
|
),
|
|
"point_difficulty": forms.NumberInput(
|
|
attrs={"class": "form-control", "placeholder": "xx,xx",}
|
|
),
|
|
"point_time_of_flight": forms.NumberInput(
|
|
attrs={"class": "form-control", "placeholder": "xx,xx",}
|
|
),
|
|
"point_horizontal_displacement": forms.NumberInput(
|
|
attrs={"class": "form-control", "placeholder": "x,xx",}
|
|
),
|
|
"penality": forms.NumberInput(
|
|
attrs={"class": "form-control", "placeholder": "xx,xx", "value": "0"}
|
|
),
|
|
"total": forms.TextInput(
|
|
attrs={
|
|
"class": "form-control",
|
|
"placeholder": "000,000",
|
|
"readonly": "readonly",
|
|
"maxlength": "6",
|
|
}
|
|
),
|
|
}
|
|
|
|
gymnast_related = forms.CharField(
|
|
widget=forms.TextInput(
|
|
attrs={
|
|
"class": "form-control",
|
|
"placeholder": "Searching…",
|
|
"data-ref": "#id_gymnast",
|
|
}
|
|
)
|
|
)
|
|
event_related = forms.CharField(
|
|
widget=forms.TextInput(
|
|
attrs={
|
|
"class": "form-control",
|
|
"placeholder": "Searching…",
|
|
"data-ref": "#id_event",
|
|
}
|
|
)
|
|
)
|