The "polls_choice" table in database file db.sqlite3 has no records, so no
radio buttons show up.
I manually added 2 records to the "polls_choice" table, then I have the
radio buttons showed up.
On Tuesday, February 7, 2017 at 6:17:58 PM UTC+8, ludovic coues wrote:
>
> Have you added some choi
Have you added some choices to the "What's up?" question ?
What you see is that question.choice_set.all is empty.
The following snippet will give you some output:
{% for choice in question.choice_set.all %}
{{ choice.choice_text
}}
{% empty %}
Sorry, no available choices.
{% endfor %
Same issue here, no radio buttons show up.
ubuntu 16.04.1 LTS
python 3.5.2
django 1.10.5
I've tried {{ question|pprint }} and {{ question.choice_set.all|pprint }}
for debugging, got:
Now trying to figure out where the problem is.
On Thursday, October 20, 2016 at 11:52:59 PM UTC+8, Othniel
I would try to add that right before the loop:
{{ question|pprint }}
{{ question.choice_set.all|pprint }}
The result should be something like that
the pprint filter is for debugging, you should remove once your issue
is fixed. It will make obvious some error like question.choi
I think the problem is from around:
{% for choice in question.choice_set.all %}
{{ choice.choice_text
}}
{% endfor %}
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.
--
You rece
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. Be
6 matches
Mail list logo