# why is the radio input in detail.html not appearing?

**URL:** <https://forum.djangoproject.com/t/why-is-the-radio-input-in-detail-html-not-appearing/31767>\
**Category:** Templates & Frontend\
**Created:** [June 5, 2024, 12:23pm UTC](https://forum.djangoproject.com/t/why-is-the-radio-input-in-detail-html-not-appearing/31767 "2024-06-05T12:23:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Omar](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/omar/32/21737_2.png) [@Omar](https://forum.djangoproject.com/u/Omar)\
**Post date:** [June 5, 2024, 12:23pm UTC](https://forum.djangoproject.com/t/why-is-the-radio-input-in-detail-html-not-appearing/31767/1 "2024-06-05T12:23:41Z")

</div>

im trying to follow the basic django poll app tutorial and the radio input field for the choices doesn’t appear on the website

detail.html

```auto
<form action="{% url 'polls:vote' question.id %}" method="post">
    {% csrf_token %}
    <fieldset>
        <legend><h1>{{ question.question_text }}</h1></legend>
        {% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
        {% 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 %}
    </fieldset>
    <input type="submit" value="Vote">
    </form>

```

views.py

```from
from django.http import HttpResponse, HttpResponseRedirect
from django.urls import reverse
from django.db.models import F

from .models import Question, Choice

def index(request):
    latest_question_list = Question.objects.order_by("-pub_date")[:5]
    context = {"latest_question_list": latest_question_list}
    return render(request, "index.html", context)

def detail(request, question_id):
    question = get_object_or_404(Question, pk=question_id)
    return render(request, "detail.html", {"question": question})

def results(request, question_id):
    question = get_object_or_404(Question, pk=question_id)
    return render(request, "results.html", {"question": question})

def vote(request, question_id):
    question = get_object_or_404(Question, pk=question_id)
    try:
        selected_choice = question.choice_set.get(pk=request.POST["choice"])
    except (KeyError, Choice.DoesNotExist):
        return render(
            request,
            "detail.html",
            {
                "question": question,
                "error_message": "You didnt select a choice",
            },
        )
    else:
        selected_choice.votes = F("votes") + 1
        selected_choice.save()
        return HttpResponseRedirect(reverse("polls:results", args=(question_id,)))

```

models.py

```auto
from django.db import models
import datetime
from django.utils import timezone

class Question(models.Model):
    question_text = models.CharField(max_length=200)
    pub_date = models.DateTimeField("date published")
    def __str__ (self):
        return self.question_text
    def was_published_recently(self):
        return self.pub_date >= timezone.now() - datetime.timedelta(days=1)

class Choice(models.Model):
    question = models.ForeignKey(Question, on_delete=models.CASCADE)
    choice_text = models.CharField(max_length=200)
    votes = models.IntegerField(default=0)
    def __str__ (self):
        return self.choice_text

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/3X/6/0/60bd48a981812bdef6e712961fdd9943329e4fe6.png)

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [June 6, 2024, 12:23am UTC](https://forum.djangoproject.com/t/why-is-the-radio-input-in-detail-html-not-appearing/31767/2 "2024-06-06T00:23:57Z")

</div>

Welcome @Omar !

Have you verified that you do have choices for the question being rendered?

Does it work if you render the fields as shown in the tutorial?

What is the HTML that was produced by the template?

(I’m guessing you’re on part 3 of the tutorial?)

---

<div class="post-metadata">

**Author:** ![Omar](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/omar/32/21737_2.png) [@Omar](https://forum.djangoproject.com/u/Omar)\
**Post date:** [June 6, 2024, 5:18am UTC](https://forum.djangoproject.com/t/why-is-the-radio-input-in-detail-html-not-appearing/31767/3 "2024-06-06T05:18:21Z")

</div>

im on part 4 of the tutorial,  
I have choices for the questions being rendered  
no, it doesn’t

```auto
<html><link type="text/css" rel="stylesheet" id="dark-mode-custom-link"><link type="text/css" rel="stylesheet" id="dark-mode-general-link"><style lang="en" type="text/css" id="dark-mode-custom-style"></style><style lang="en" type="text/css" id="dark-mode-native-style"></style><style lang="en" type="text/css" id="dark-mode-native-sheet"></style><head><style>@font-face {
              font-family: 'Open Sans Regular';
              font-style: normal;
              font-weight: 400;
              src: url('chrome-extension://gkkdmjjodidppndkbkhhknakbeflbomf/fonts/open_sans/open-sans-v18-latin-regular.woff');
          }</style><style>@font-face {
              font-family: 'Open Sans Bold';
              font-style: normal;
              font-weight: 800;
              src: url('chrome-extension://gkkdmjjodidppndkbkhhknakbeflbomf/fonts/open_sans/OpenSans-Bold.woff');
          }</style><style>@font-face {
              font-family: 'Open Sans ExtraBold';
              font-style: normal;
              font-weight: 800;
              src: url('chrome-extension://gkkdmjjodidppndkbkhhknakbeflbomf/fonts/open_sans/open-sans-v18-latin-800.woff');
          }</style></head><body data-new-gr-c-s-check-loaded="14.1177.0" data-gr-ext-installed=""><form action="/polls/1/vote/" method="post">
    <input type="hidden" name="csrfmiddlewaretoken" value="XUbAPjzC10Hgofb6uvpcMSSlbe7CicTGQ457PgEfHgCSJEGhhyb9mboIs257wRFP">
    <fieldset>
        <legend><h1>What's up?</h1></legend>
        

        <p>Question ID: 1</p>
        <p>Question Text: What's up?</p>
        <p>Choices:</p>
        <ul>
            
                <li>No choices available.</li>
            
        </ul>

        
    </fieldset>
    <input type="submit" value="Vote">
</form></body><grammarly-desktop-integration data-grammarly-shadow-root="true"></grammarly-desktop-integration></html>

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [June 6, 2024, 1:02pm UTC](https://forum.djangoproject.com/t/why-is-the-radio-input-in-detail-html-not-appearing/31767/4 "2024-06-06T13:02:41Z")

</div>

This output does not match the template you’re showing.

This leads me to believe that one (or more) of the following are true:

- You are not showing the complete template you are trying to render.

- You’re not rendering the template you think you’re rendering.

- You do not actually have any choices for question with ID = 1
