Saturday, October 22, 2016

Re: Tutorial part 4 help: the raidio buttons to make a choice on the polls question won't show.

I would try to add that right before the loop:

{{ question|pprint }}
{{ question.choice_set.all|pprint }}

The result should be something like that

<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.

2016-10-21 12:32 GMT+02:00 Othniel Ayinzat <othnielhash@gmail.com>:
> I think the problem is from around:
>
> {% for choice in question.choice_set.all %}
> <input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{
> choice.id }}" />
> <label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label><br
> />
> {% 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 received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscribe@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/529b45cc-c1ec-46d8-90eb-26c30aad2989%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--

Cordialement, Coues Ludovic
+336 148 743 42

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEuG%2BTZcngpunhPU8di8MpQPqbkpcO98S9UwqddEVHzL68CfSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment