summaryrefslogtreecommitdiff
path: root/stapp/video/views.py
blob: 3ec195343cf0f6aa997a652558678c0f45e3cba3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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]


    context = { 'modules' : latest_modules , 'play' : latest_video}
    return render(request, 'video/home.html', context)