I have an inline formset that only has three fields:
class Estimate_Product_Details(models.Model):
proposalID = models.ForeignKey(Estimate_Construction, verbose_name='Proposal ID')
CID = models.ForeignKey(Product, verbose_name = 'CID')
qty = models.DecimalField(max_digits = 7, decimal_places = 2, verbose_name = 'Quantity')
def __unicode__(self):
return u'%s -- %s' % (self.proposalID, self.CID)
I then create a form from that model:
class Product_Form(ModelForm):
class Meta:
model = Estimate_Product_Details
fields = ('CID', 'qty')
widgets = {
'qty' : forms.TextInput(attrs={'size':30})
}
My goal is to have the qty input field really small (I have 30 there for testing). However, when I render this form via an inline formset, the attribute is not being set at all. Here's the creation of the formset in my view:
pFormSet = inlineformset_factory(Estimate_Construction, Estimate_Product_Details, form = Product_Form)
Where am I going wrong? Why doesn't the qty field change in size?