blob: 8b7240d8c1e97dfa3145906acb2eff7a2e28b050 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
from django.http import HttpResponse
from django.template import RequestContext
from django.shortcuts import render, get_object_or_404, redirect
from video.models import Video, Module
def show(request):
videos = Video.objects.all()
if len(videos) == 0 :
return HttpResponse("No videos in Database...")
#Get the latest video to display on the front page
latest_video = Video.objects.latest('created')
#Get last three modified modules
latest_modules = Module.objects.order_by('-modified')[0:3]
all_modules = Module.objects.order_by('modified')
context = { 'latest_modules' : latest_modules , 'play' : latest_video, 'all_modules':all_modules}
return render(request, 'video/home.html', context)
|