Tutorial part 4 help: the raidio buttons to make a choice on the polls question won't show.
424 views
Skip to first unread message
Othniel Ayinzat
unread,
Oct 20, 2016, 11:52:59 AM10/20/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
Hi guys,
I have been following the django tutorials up to part 4 on the polls application. My details template only displays the vote submit button but the radio buttons for making choices won't show. I have been battling with this for some hours now and i need help or some pointers. Thanks. Below are the code snippets for the polls app.
polls/templates/polls/detail.html
-----------------------------------------------
<h1>{{ question.question_text }}</h1>
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
This is because i tested outside the loop and i got the radio button, but the whole idea was to loop through the questions and assign a button for the choices.
ludovic coues
unread,
Oct 22, 2016, 3:44:49 PM10/22/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
<class 'app.Question'>
<choices list([choice a, choice b])>
the pprint filter is for debugging, you should remove once your issue
is fixed. It will make obvious some error like question.choice_set.all
not returning the kind of data you expect.