from django import forms from datetime import date from .models import Routine, RoutineSkill class RoutineForm(forms.ModelForm): class Meta: model = Routine fields = ("long_label", "short_label", "difficulty", "level", "active", 'informations') widgets = { # Champs obligatoires de la classe mère. 'long_label': forms.TextInput( attrs={"class": "form-control", "placeholder": "Routine's long name"} ), 'short_label': forms.TextInput( attrs={"class": "form-control", "placeholder": "Routine's short name"} ), 'informations': forms.Textarea( attrs={ "class": "form-control", "placeholder": "Informations about the psychological state of mind : context (why, where, …), possible consequencies, …", } ), 'difficulty': forms.HiddenInput(), 'level': forms.HiddenInput(), 'active': forms.HiddenInput(), }