Пример #1
0
def watch_page(request):

    context = {
        'featured_videos': VideoIndex.get_featured_videos()[:VideoIndex.IN_ROW],
        'popular_videos': VideoIndex.get_popular_videos()[:VideoIndex.IN_ROW],
        'latest_videos': VideoIndex.get_latest_videos()[:VideoIndex.IN_ROW*3],
        'popular_display_views': 'week'
    }
    return render_to_response('videos/watch.html', context,
                              context_instance=RequestContext(request)) 
Пример #2
0
def watch_page(request):

    context = {
        'featured_videos':
        VideoIndex.get_featured_videos()[:VideoIndex.IN_ROW],
        'popular_videos': VideoIndex.get_popular_videos()[:VideoIndex.IN_ROW],
        'latest_videos':
        VideoIndex.get_latest_videos()[:VideoIndex.IN_ROW * 3],
        'popular_display_views': 'week'
    }
    return render_to_response('videos/watch.html',
                              context,
                              context_instance=RequestContext(request))
Пример #3
0
def watch_page(request):

    # Assume we're currently indexing if the number of public
    # indexed vids differs from the count of video objects by
    # more than 1000
    is_indexing = cache.get('is_indexing')
    if is_indexing is None:
        is_indexing = Video.objects.all().count() - VideoIndex.public().count() > 1000
        cache.set('is_indexing', is_indexing, 300)

    context = {
        'featured_videos': VideoIndex.get_featured_videos()[:VideoIndex.IN_ROW],
        'latest_videos': VideoIndex.get_latest_videos()[:VideoIndex.IN_ROW*3],
        'is_indexing': is_indexing
    }
    return render_to_response('videos/watch.html', context,
                              context_instance=RequestContext(request))