1๐
โ
I think, you already specified the fields name
and surname
in the class itself, so you should use inline widgets not Meta widgets, as they are used for overriding default widgets, so:
class AuthorForm(ModelForm):
name = forms.CharField(validators=[isStandardized],widget=forms.TextInput(attrs={'class':'form-control','placeholder':'Name of an author'}))
surname = forms.CharField(validators=[isStandardized],widget=forms.TextInput(attrs={'class':'form-control','placeholder':'surname of an author' }))
class Meta:
model = SearchStats
fields = ['name', 'surname', 'author_id', 'amount']
widgets = {
'author_id': forms.TextInput(attrs={'type':'hidden'}),
'amount': forms.TextInput(attrs={'type':'hidden'})
}
๐คSunderam Dubey
Source:stackexchange.com