-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathviews.py
More file actions
42 lines (33 loc) · 1.16 KB
/
views.py
File metadata and controls
42 lines (33 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from videos.models import Faq, Stream
from django.http import Http404
from django.contrib.auth.models import User
from django.template import RequestContext
def home(request):
streams_list=Stream.objects.all()
user=request.user
return render_to_response('videos/index.html',locals())
def stream_detail(request,stream_url_friendly):
user=request.user
if (user.is_authenticated()):
completed_videos=user.userprofile_set.all()[0].completed_videos.all()
try:
stream=False
streams=Stream.objects.all()
for s in streams:
if (s.url_friendly()==stream_url_friendly):
stream=s
break
if (not stream):
raise Http404
associations_list=stream.association_set.all().order_by('association_part')
except Stream.DoesNotExist:
raise Http404
return render_to_response('videos/stream_detail.html',locals(),context_instance=RequestContext(request))
def faq(request):
if ('pk' in request.GET) and request.GET['pk'].strip():
key=int(request.GET['pk'])
j=1
faq_list=Faq.objects.all().order_by('faq_order')
return render_to_response('faq.html',locals())