Issue
I would like to add the required
attribute in the product_title field. How can I do It?
class add_product_info(forms.ModelForm):
product_desc = RichTextField()
class Meta:
model = Products
fields = ('product_title')
labels = {'product_title':'Title'}
widgets = {
'product_title':forms.TextInput(attrs={'class':'form-control', 'style':'font-size:13px;'})
}
Solution
Just the same way like you added the style
or class
attribute:
class add_product_info(forms.ModelForm):
product_desc = RichTextField()
class Meta:
model = Products
fields = ('product_title')
labels = {'product_title':'Title'}
widgets = {
'product_title':forms.TextInput(attrs={'class':'form-control', 'style':'font-size:13px;', 'required': True})
}
Answered By - JanMalte
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.