Skip to content

Instantly share code, notes, and snippets.

@solidpple
Created December 17, 2017 13:44
Show Gist options
  • Save solidpple/fc50784961b27dfd9945569a2513ed6c to your computer and use it in GitHub Desktop.
Save solidpple/fc50784961b27dfd9945569a2513ed6c to your computer and use it in GitHub Desktop.
from django.http import HttpResponse
from .models import Question
def index(request):
latest_question_list = Question.objects.order_by('-pub_date')[:5]
output = ', '.join([q.question_text for q in latest_question_list])
return HttpResponse(output)
# Leave the rest of the views (detail, results, vote) unchanged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment