I have the following code in Django for a Form.
class ProductAddToCartForm(forms.Form):
quantity = forms.IntegerField(widget=forms.TextInput(attrs={'size':'2', 'value':'1', 'class':'quantity', 'maxlength':'5'}), error_messages={'invalid':'Please enter a valid quantity.'}, min_value =1)
product_slug = forms.CharField(widget=forms.HiddenInput())
sizes_available = []
sizes_available.append(7)
sizes_available.append(9)
size = forms.ChoiceField(widget=forms.Select, choices=sizes_available)
However when I compile this the ChoiceField, CharField and the IntegerField doesn’t show up. When I comment out the line with size = ... then IntegerField and CharField shows up. I think there is something wrong with my ChoiceField declaration but I’m not sure what exactly.
https://docs.djangoproject.com/en/1.4/ref/forms/fields/#choicefield
Choices must be
Try to .
append((7,7))