added html for detail
This commit is contained in:
parent
dfcf39539b
commit
e4ebde5944
1
polls/templates/polls/detail.html
Normal file
1
polls/templates/polls/detail.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{ question }}
|
||||||
@ -1,5 +1,5 @@
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse, Http404
|
||||||
from django.template import loader
|
from django.template import loader
|
||||||
|
|
||||||
from .models import Question
|
from .models import Question
|
||||||
@ -14,7 +14,11 @@ def index(request):
|
|||||||
|
|
||||||
|
|
||||||
def detail(request, question_id):
|
def detail(request, question_id):
|
||||||
return HttpResponse("You're looking at question %s." % question_id)
|
try:
|
||||||
|
question = Question.objects.get(pk=question_id)
|
||||||
|
except Question.DoesNotExist:
|
||||||
|
raise Http404("Question does not exist")
|
||||||
|
return render(request, "polls/detail.html", {"question": question})
|
||||||
|
|
||||||
|
|
||||||
def results(request, question_id):
|
def results(request, question_id):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user