Ultron/ultron/objective/forms.py

69 lines
1.9 KiB
Python
Raw Normal View History

2021-12-09 16:53:44 +01:00
from django import forms
2022-01-07 18:08:39 +01:00
from .models import (
2022-10-15 18:58:44 +02:00
Skill,
Routine,
RoutineSkill
)
2021-12-09 16:53:44 +01:00
2022-10-15 18:58:44 +02:00
class SkillForm(forms.ModelForm):
class Meta:
model = Skill
fields = (
"informations",
)
widgets = {
"informations": forms.Textarea(
attrs={
"class": "form-control",
"placeholder": "Informations about the skill : attention point, methodology, biomecanics, …", # pylint: disable=line-too-long
}
),
}
2021-12-09 16:53:44 +01:00
class RoutineForm(forms.ModelForm):
class Meta:
model = Routine
2021-12-19 09:30:51 +01:00
fields = (
"long_label",
"short_label",
"difficulty",
"level",
"is_active",
2021-12-19 09:30:51 +01:00
"informations",
)
2021-12-09 16:53:44 +01:00
widgets = {
2021-12-19 09:30:51 +01:00
"long_label": forms.TextInput(
attrs={"class": "form-control", "placeholder": "Routine's long name"}
2021-12-09 16:53:44 +01:00
),
2021-12-19 09:30:51 +01:00
"short_label": forms.TextInput(
attrs={"class": "form-control", "placeholder": "Routine's short name"}
2021-12-09 16:53:44 +01:00
),
2021-12-19 09:30:51 +01:00
"informations": forms.Textarea(
2021-12-09 16:53:44 +01:00
attrs={
2021-12-19 09:30:51 +01:00
"class": "form-control",
2022-01-07 18:08:39 +01:00
"placeholder": "Informations about the psychological state of mind : context (why, where, …), possible consequencies, …", # pylint: disable=line-too-long
2021-12-09 16:53:44 +01:00
}
),
2021-12-19 09:30:51 +01:00
"difficulty": forms.HiddenInput(),
"level": forms.HiddenInput(),
"is_active": forms.HiddenInput(),
2022-01-07 18:08:39 +01:00
}
class RoutineSkillForm(forms.ModelForm):
class Meta:
model = RoutineSkill
fields = (
"routine",
"skill",
"rank",
)
widgets = {
"routine": forms.HiddenInput(),
"skill": forms.HiddenInput(),
"rank": forms.NumberInput(),
}