2023-04-25 17:06:14 +02:00
from django import forms
2023-04-30 12:25:13 +02:00
from . models import Skill , Combination , CombinationSkill
2023-04-25 17:06:14 +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
}
) ,
}
2023-04-30 12:25:13 +02:00
class CombinationForm ( forms . ModelForm ) :
2023-04-25 17:06:14 +02:00
class Meta :
2023-04-30 12:25:13 +02:00
model = Combination
2023-04-25 17:06:14 +02:00
fields = (
" long_label " ,
" short_label " ,
" difficulty " ,
" level " ,
" is_active " ,
" informations " ,
)
widgets = {
" long_label " : forms . TextInput (
2023-04-30 12:25:13 +02:00
attrs = {
" class " : " form-control " ,
" placeholder " : " Combination ' s long name " ,
}
2023-04-25 17:06:14 +02:00
) ,
" short_label " : forms . TextInput (
2023-04-30 12:25:13 +02:00
attrs = {
" class " : " form-control " ,
" placeholder " : " Combination ' s short name " ,
}
2023-04-25 17:06:14 +02:00
) ,
" informations " : forms . Textarea (
attrs = {
" class " : " form-control " ,
" placeholder " : " Informations about the psychological state of mind : context (why, where, …), possible consequencies, … " , # pylint: disable=line-too-long
}
) ,
" difficulty " : forms . HiddenInput ( ) ,
" level " : forms . HiddenInput ( ) ,
" is_active " : forms . HiddenInput ( ) ,
}
2023-04-30 12:25:13 +02:00
class CombinationSkillForm ( forms . ModelForm ) :
2023-04-25 17:06:14 +02:00
class Meta :
2023-04-30 12:25:13 +02:00
model = CombinationSkill
2023-04-25 17:06:14 +02:00
fields = (
2023-04-30 12:25:13 +02:00
" combination " ,
2023-04-25 17:06:14 +02:00
" skill " ,
" rank " ,
)
widgets = {
2023-04-30 12:25:13 +02:00
" combination " : forms . HiddenInput ( ) ,
2023-04-25 17:06:14 +02:00
" skill " : forms . HiddenInput ( ) ,
" rank " : forms . NumberInput ( ) ,
}