from django.http import HttpResponse from django.shortcuts import render from django.views import generic from .models import Movie def index(request): return HttpResponse("Hello, world. You're at the movies index.") class IndexView(generic.ListView): template_name = "movies/index.html" context_object_name = "latest_movies" def get_queryset(self): """Return the last five published questions.""" return Movie.objects.order_by("-added_date")[:5]