How to add classes to Fields in Forms.py?

Good afternoon, prompt how to add classes to the fields when creating your forms in forms.py ?
June 8th 19 at 17:31
1 answer
June 8th 19 at 17:33
Solution
This is detailed in the documentation:

class SomeForm(forms.ModelForm):
 class Meta:
 mode = SomeModel
 fields = ('one_field', 'another_field')
 labels = {
 'one_field': 'the Label is different from the field name in the model',
}
 widgets = {
 'another_field': forms.TextInput(attrs={'class': 'some-class', 'placeholder': 'Lorem ipsum'}),
 }
Thank you! - martina commented on June 8th 19 at 17:36

Find more questions by tags DjangoPython