Why dont you use a widget with charfield forms.CharField(max_length=1, widget=forms.Select (choices=CHOICES))
and your choices are CHOICE = ( ('A', 'A'), ('B', 'B'), ('C', 'C'), ) On Apr 19, 4:56 pm, amyhalf <afreder...@gmail.com> wrote: > For the life of me I can't get Django to render even the simplest of > HTML <SELECT> boxes. > > Here's a recent example that I have which I cannot get to work. > > This is the form: > > class CreditCardForm(forms.Form): > fullname = forms.CharField(128, 1, required = True) > mm_expiry = forms.ChoiceField(required = True) > > In the view, I do the following before sending it to the template: > > form = CreditCardForm() > form.mm_expiry.choices = (('1','1'), ('2','2')) > > Here's how I print it in the template: > > <td>Expiration date:</td> > <td>{{ form.mm_expiry }}</td> > > It does make the <SELECT> tag but will not populate the individual > items. > > Help! > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.