mirror of
https://github.com/skoobasteeve/django-movies.git
synced 2026-03-20 03:28:59 +00:00
initial movies app
This commit is contained in:
18
apps/movies/views.py
Normal file
18
apps/movies/views.py
Normal file
@@ -0,0 +1,18 @@
|
||||
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]
|
||||
Reference in New Issue
Block a user