1👍
✅
Please update the question that you want to use jQuery.Django by defaults generate id for its form element.
As avinash already said you can always inspect the element and get the id and classses but some time we need custom class in that case you can use something like.
If you want to write your own custom fields.
class myForm(forms.ModelForm):
class Meta:
model = ModeName
widgets = {
'field_one': forms.TextInput(attrs={'id':'foo', 'name':'foo'})
'field_two': forms.TextInput(attrs={'id':'bar', 'name':'bar'})
}
Source:stackexchange.com