Ticket #2355: tut03.diff
File tut03.diff, 855 bytes (added by , 18 years ago) |
---|
-
tutorial03.txt
189 189 from django.http import HttpResponse 190 190 191 191 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] 193 193 output = ', '.join([p.question for p in latest_poll_list]) 194 194 return HttpResponse(output) 195 195 … … 202 202 from django.http import HttpResponse 203 203 204 204 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] 206 206 t = loader.get_template('polls/index.html') 207 207 c = Context({ 208 208 'latest_poll_list': latest_poll_list,