coulix wrote:

hi, i am writting a generic create object view for my recipe model.
i can get the form display well using this kind of code :

<p><label for="name">Nom de la recette</label> {{form.nom}} </p>
ect ..,
But is there a way of automatically checking if {{ form.nom }} is a
recquired field ? (and therefore put a star near it like this).
form.nom.formfield.is_required

By the way an HTML element itself rendered for a field would have "required" class set if it is required. So to style the element you can use this selector in CSS:

#id_nom.required {
...
}

Reply via email to