Hi, I am having the same problem that it does not display bulleted list, but I do not have a typo. Below is what I have got.
*mysite>>polls>>view.py* from django.http import HttpResponse from django.template import loader from .models import Question def index(request): latest_question_list = Question.objects.order_by('-pub_date')[:5] template = loader.get_template('polls/index.html') context = { 'latest_question_list': latest_question_list, } output = ', '.join([q.question_text for q in latest_question_list]) return HttpResponse(output) *mysite>>polls>>templates>>polls>>index.html* {% if latest_question_list %} <ul> {% for question in latest_question_list %} <li><a href="/polls/{{ question.id }}/">{{ question.question_text }}</a></li> {% endfor %} </ul> {% else %} <p>No polls are available.</p> {% endif %} *Can anyone help please? Thank you in advance* On Wednesday, 19 October 2016 00:29:44 UTC+1, Johnny McClung wrote: > > Thanks so much everyone. I looked over those files many times and I > couldn't see it. > > > > On Tuesday, October 18, 2016 at 5:17:55 PM UTC-4, James Schneider wrote: >> >> >> >> On Tue, Oct 18, 2016 at 11:00 AM, Johnny McClung <jdmc...@gmail.com> >> wrote: >> >>> I have gotten down to the part where the tutorial reads "Load the page >>> by pointing your browser at “/polls/”, and you should see a bulleted-list >>> containing the “What’s up” question from Tutorial 2. The link points to the >>> question’s detail page." >>> >>> I do not see a bulleted-list. All I see is "No polls are available." >>> >>> This makes me think that I have an error in the if statement in the >>> template index.html. However, I can not find the error or why it is not >>> showing me the list. Any help would be appreciated. >>> >> >> The {% if %} statement is fine. >> >> >> >>> mysite>>polls>>templates>>polls>>index.html >>> >>> {% if latest_question_list %} >>> <ul> >>> {% for quesion in latest_question_list %} >>> >> >> You do have a typo in your {% for %} loop, however. >> >> >> >> >> >>> def index(request): >>> latest_question_list = Question.objects.order_by('-pub_date')[:5] >>> template = loader.get_template('polls/index.html') >>> context = {'latest_quesion_list': latest_question_list,} >>> return HttpResponse(template.render(context, request)) >>> >>> >> This is where your issue is. Your template context dictionary also has >> the same typo as your {% for %} loop, so the {% if %} statement is >> returning False because the variable it is checking (which is spelled >> correctly) doesn't exist. >> >> -James >> > -- 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+unsubscr...@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/1efc7e17-0d93-4697-bb27-37b8b1511d2f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.