summaryrefslogtreecommitdiff
path: root/stapp/video/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'stapp/video/views.py')
-rw-r--r--stapp/video/views.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/stapp/video/views.py b/stapp/video/views.py
index 8b7240d..d517c74 100644
--- a/stapp/video/views.py
+++ b/stapp/video/views.py
@@ -2,6 +2,7 @@ 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
+from taggit.models import Tag
def show(request):
videos = Video.objects.all()
@@ -14,8 +15,16 @@ def show(request):
#Get last three modified modules
latest_modules = Module.objects.order_by('-modified')[0:3]
all_modules = Module.objects.order_by('modified')
+ tags = Tag.objects.all()
-
- context = { 'latest_modules' : latest_modules , 'play' : latest_video, 'all_modules':all_modules}
+ context = { 'latest_modules' : latest_modules , 'play' : latest_video, 'all_modules':all_modules,'tags':tags}
return render(request, 'video/home.html', context)
+
+def show_tags_video(request,tag_name=None):
+ if tag_name==None:
+ return redirect('/')
+ videos = Video.objects.filter(tags__name__in=[tag_name])
+ context = {'videos':videos}
+ return render(request,'video/tag_video.html',context)
+