Files
django-movies/apps/movies/views.py
2026-02-28 13:04:19 -05:00

19 lines
485 B
Python

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]