Ticket #2355: tut03.diff

File tut03.diff, 855 bytes (added by django@…, 18 years ago)
  • tutorial03.txt

     
    189189    from django.http import HttpResponse
    190190
    191191    def index(request):
    192         latest_poll_list = Poll.objects.all().order_by('-pub_date')
     192        latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
    193193        output = ', '.join([p.question for p in latest_poll_list])
    194194        return HttpResponse(output)
    195195
     
    202202    from django.http import HttpResponse
    203203
    204204    def index(request):
    205         latest_poll_list = Poll.objects.all().order_by('-pub_date')
     205        latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
    206206        t = loader.get_template('polls/index.html')
    207207        c = Context({
    208208            'latest_poll_list': latest_poll_list,
Back to Top