Fixed #2355 -- Corrected a couple of small typos in code examples in tutorial03.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3359 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
c6cbfb3d7c
commit
533594d1a5
|
@ -189,7 +189,7 @@ publication date::
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
latest_poll_list = Poll.objects.all().order_by('-pub_date')
|
latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
|
||||||
output = ', '.join([p.question for p in latest_poll_list])
|
output = ', '.join([p.question for p in latest_poll_list])
|
||||||
return HttpResponse(output)
|
return HttpResponse(output)
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ So let's use Django's template system to separate the design from Python::
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
latest_poll_list = Poll.objects.all().order_by('-pub_date')
|
latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
|
||||||
t = loader.get_template('polls/index.html')
|
t = loader.get_template('polls/index.html')
|
||||||
c = Context({
|
c = Context({
|
||||||
'latest_poll_list': latest_poll_list,
|
'latest_poll_list': latest_poll_list,
|
||||||
|
|
Loading…
Reference in New Issue