summaryrefslogtreecommitdiff
path: root/stapp/video/views.py
blob: 8361b9f4d6a9e3ec7e1dc93d5aeb517713c926ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from django.http import HttpResponse
from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404, redirect
from video.models import Video

def show(request,video_id=None):
    videos = Video.objects.all()
    if len(videos) == 0 :
        return HttpResponse("No videos in Database...")
    play_video = None
    if video_id != None :
        play_video = Video.objects.get(id = video_id)
    else:
        play_video = videos[len(videos)-1]
    vids = { 'videos' : videos , 'play' : play_video}
    return render_to_response('video/list_videos.html', vids)