Пример #1
0
def view_featured(request, enc):
    context = {'hero': cached_sets.get_hero(models.feat.FEATURED_PAGE),
               'mostviewed': cached_sets.most_viewed()[:6],
               'category_bestof_fgs': helpers.get_category_bestof_fgs(),
               'next': '/browse/featured',
               'send_to_details': localsettings.FEATURE['send_to_details'],
               'posts': webhelpers.get_latest_fg_blog_posts(),
               }
    controller.record_stat(request, 'view_browse_feat_website', '0', '')
    return webhelpers.flowgram_lister(request,
                                      enc=enc,
                                      queryset=cached_sets.get_featured(models.feat.FEATURED_PAGE),
                                      template_name='flowgram/view_featured.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'],})