Code for my view.py
from django.shortcuts import render
from django.http import HttpResponse
from django.http import Http404
from django.shortcuts import render
from django.template import loader
from .models import Question
# Create your views here.
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,
}
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 HttpResponse(response % question_id)
def vote(request, question_id):
return HttpResponse("You're voting on question %s." % question_id)
According to the tutorial, I'm supposed to have: "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
<https://docs.djangoproject.com/en/2.0/intro/tutorial02/>. The link points
to the question’s detail page." which I'm not seeing.
--
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/ebf4db21-0c96-4e03-81fd-4fb5f125e96c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.