mirror of
https://github.com/skoobasteeve/django-movies.git
synced 2026-03-20 03:28:59 +00:00
19 lines
485 B
Python
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]
|