I'm trying to display DB data in a dropdon box on a screen using a form. Here's my form/formfield code:
from django import forms class AddChoiceForm(forms.Form): ccount = forms.IntegerField() pquestion = forms.CharField() message = forms.CharField() polls = forms.ChoiceField(required=True) newchoice = forms.CharField() and here's the html code for my screen: <h1>Add Poll Choice Screen</h1> <form action="/polls/addchoice/" method="POST"> {% csrf_token %} {{ message }} <br /><br /> {{ polls }} <br /><br /> <input type="submit" value="addchoice" /> <br /><br /> </form> and finally here's the view code for addchoice: def addchoice(request): polls = get_list_or_404(Poll) pollcount = Poll.objects.all().count() if pollcount > 0 : message = "Number of polls passed to form was " + str(pollcount) else: message = "No polls passed in to form." data = {'polls': polls, 'message': message } form = AddChoiceForm(data) return render_to_response('polls/addchoice.html', { 'form': form }) I had expected this to just display the message field on my screen and the DB entries in the drop down, but when the screen is rendered I'm only seeing the screen title at the top and the button near the bottom. So where's problem with the code? Or is there more default widget coding I need to do to setup the widget for the choice field which will contain the DB values? Please advise. Thanks. -- 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.