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


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)