예제 #1
0
def view_toprated(request, enc):
    context = get_default_context()
    context['next'] = '/browse/toprated'
    controller.record_stat(request, 'view_browse_rate_website', '0', '')
    return webhelpers.flowgram_lister(request, 
                                      enc=enc,
                                      queryset=cached_sets.top_rated(),
                                      template_name='flowgram/view_toprated.html',
                                      extra_context=context)
예제 #2
0
def view_ajax_browse(request, enc, browse_type, user):
    stat_string = 'FGs owner user id = ' + (user.username if user else 'None')

    if browse_type == 'featured':
        fg_data_set = [cached_sets.get_hero(models.feat.FEATURED_PAGE)] + \
                          cached_sets.get_featured(models.feat.FEATURED_PAGE)[:11]
        controller.record_stat(request, 'view_browse_feat_ajax_website', '0', '')
    elif browse_type == 'newest':
        fg_data_set = cached_sets.newest()[:12]
        controller.record_stat(request, 'view_browse_feat_new_website', '0', '')
    elif browse_type == 'most_viewed':
        fg_data_set = cached_sets.most_viewed()[:12]
        controller.record_stat(request, 'view_browse_most_ajax_website', '0', '')
    elif browse_type == 'most_discussed':
        fg_data_set = cached_sets.most_discussed()[:12]
        controller.record_stat(request, 'view_browse_disc_ajax_website', '0', '')
    elif browse_type == 'top_rated':
        fg_data_set = cached_sets.top_rated()[:12]
        controller.record_stat(request, 'view_browse_rate_ajax_website', '0', '')
    elif browse_type == 'user_newest':
        fg_data_set = cached_sets.user_newest(user.username)[:6]
        controller.record_stat(request, 'view_browse_new_ajax_website', '0', stat_string)
    elif browse_type == 'user_most_viewed':
        fg_data_set = cached_sets.user_most_viewed(user.username)[:6]
        controller.record_stat(request, 'view_browse_most_ajax_website', '0', stat_string)
    elif browse_type == 'user_most_discussed':
        fg_data_set = cached_sets.user_most_discussed(user.username)[:6]
        controller.record_stat(request, 'view_browse_disc_ajax_website', '0', stat_string)
    elif browse_type == 'user_top_rated':
        fg_data_set = cached_sets.user_top_rated(user.username)[:6]
        controller.record_stat(request, 'view_browse_rate_ajax_website', '0', stat_string)
    elif browse_type == 'user_title':
        fg_data_set = cached_sets.user_title(user.username)[:6]
        controller.record_stat(request, 'view_browse_title_ajax_website', '0', stat_string)
    
    return helpers.req_render_to_response(request,
                                          'includes/modules/flowgram/fg_modules_ajax.incl',
                                          {'fg_data_set': fg_data_set,
                                           'fg_timestamp': request.user == user,
                                           'send_to_details': localsettings.FEATURE['send_to_details'],})
예제 #3
0
def get_top_rated_flowgrams():
    return cached_sets.top_rated()