Exemple #1
0
def list_videos(request):
    subjects = Subject.objects.all()
    videos = []
    q  = ''
    max_lengths = [10, 15, 20, 25, 30, 50]
    results = None
    if 'q' and 'results' in request.GET:
        q = request.GET['q']
        results = request.GET['results']
        videos =  youtube_search(q, results)
    return render(request,'videos/list.html', {'videos': videos, 'q': q, 'results': results, 'subjects': subjects, 'max_lengths': max_lengths})
Exemple #2
0
def list_videos(request):
    subjects = Subject.objects.all()
    videos = []
    q = None
    max_lengths = [10, 15, 20, 25, 30, 50]
    results = None
    if 'q' and 'results' in request.GET:
        q = request.GET['q'] + ' programming'  # mostly tech targeted
        results = request.GET['results']
        request.user.profile.get_award_points(5)
        possibly_award_badge("list_videos", user=request.user)
        videos = youtube_search(q, results)
    return render(
        request, 'videos/list.html', {
            'videos': videos,
            'q': q,
            'results': results,
            'subjects': subjects,
            'max_lengths': max_lengths
        })