NYC On Oct 19, 2016 12:57 AM, "Vijay Khemlani" <[email protected]> wrote:
> You wrote "latest_quesion_list" in the context dictionary key, it should > be "latest_question_list" > > On Tue, Oct 18, 2016 at 3:00 PM, Johnny McClung <[email protected]> > 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. >> >> mysite>>polls>>templates>>polls>>index.html >> >> {% if latest_question_list %} >> <ul> >> {% for quesion 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 %} >> >> >> mysite>>polls>>urls.py >> from django.conf.urls import url >> >> >> from . import views >> >> urlpatterns = [ >> url(r'^$', views.index, name='index'), >> url(r'^(?P<question_id>[0-9]+)/$', views.detail, name='detail'), >> url(r'^(?P<question_id>[0-9]+)/results/$', views.results, >> name='results'), >> url(r'^(?P<question_id>[0-9]+)/vote/$', views.vote, name='vote'), >> ] >> >> >> . >> mysite>>polls>>views.py >> from django.shortcuts import render >> >> # Create your views here. >> 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_quesion_list': latest_question_list,} >> return HttpResponse(template.render(context, request)) >> >> >> def detail(request, question_id): >> return HttpResponse("You're looking at question %s." % question_id) >> >> def results(request, question_id): >> response = "You're looking at the results of question %s." >> return HttpResonse(response % question_id) >> >> def vote(request, question_id): >> return HttpResponse("You're voting on question %s." % question_id) >> >> -- >> 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 [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/django-users. >> To view this discussion on the web visit https://groups.google.com/d/ms >> gid/django-users/f0899689-fb34-4728-8ec6-7bfc661c348c%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/f0899689-fb34-4728-8ec6-7bfc661c348c%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > 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/CALn3ei3LO9jqt5q7hAycoK5q1iUzt > jzHQdKrdtmZ%3Dg2VEg6%2B1A%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CALn3ei3LO9jqt5q7hAycoK5q1iUztjzHQdKrdtmZ%3Dg2VEg6%2B1A%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. 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/CAAcanss%2BtrRhBSVwXV9UFPot90X8W6uyOkh9bs907RS4s9_PrA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

