src/ldt/ldt/ldt_utils/views/front.py
changeset 444 2711eef17092
parent 443 ef326411c1fe
child 445 ba508b671698
child 447 91d87f958a16
equal deleted inserted replaced
443:ef326411c1fe 444:2711eef17092
    19     # Get the most annotated contents
    19     # Get the most annotated contents
    20     most_contents = Content.objects.order_by('-nb_annotation')[:8]
    20     most_contents = Content.objects.order_by('-nb_annotation')[:8]
    21     # Get the active groups
    21     # Get the active groups
    22     active_groups = Group.objects.exclude(name=settings.PUBLIC_GROUP_NAME)[:5]
    22     active_groups = Group.objects.exclude(name=settings.PUBLIC_GROUP_NAME)[:5]
    23     # Get the main tag list
    23     # Get the main tag list
    24     tag_cloud = get_content_tags(5)
    24     front_tags = settings.FRONT_TAG_LIST
       
    25 
    25     
    26     
    26     is_gecko = ((request.META['HTTP_USER_AGENT'].lower().find("firefox")) > -1);
    27     is_gecko = ((request.META['HTTP_USER_AGENT'].lower().find("firefox")) > -1);
    27 
    28 
    28     return render_to_response("front/front_home.html",
    29     return render_to_response("front/front_home.html",
    29                               {'last_contents': last_contents, 'most_contents':most_contents, 'active_groups':active_groups, 'tag_cloud':tag_cloud,
    30                               {'last_contents': last_contents, 'most_contents':most_contents, 'active_groups':active_groups, 'front_tags':front_tags,
    30                                'is_gecko': is_gecko},
    31                                'is_gecko': is_gecko},
    31                               context_instance=RequestContext(request))
    32                               context_instance=RequestContext(request))
    32 
    33 
    33 
    34 
    34 @login_required
    35 @login_required
    57     if tag_label is None :
    58     if tag_label is None :
    58         content_list = add_change_attr(request.user, Content.safe_objects.all())
    59         content_list = add_change_attr(request.user, Content.safe_objects.all())
    59     else :
    60     else :
    60         content_list = TaggedItem.objects.get_by_model(add_change_attr(request.user, Content.safe_objects.all()), '"'+tag_label+'"')
    61         content_list = TaggedItem.objects.get_by_model(add_change_attr(request.user, Content.safe_objects.all()), '"'+tag_label+'"')
    61     # Get the main tag list
    62     # Get the main tag list
       
    63     front_tags = settings.FRONT_TAG_LIST
       
    64     # Get the all tags list
    62     tag_cloud = get_content_tags()
    65     tag_cloud = get_content_tags()
    63     
    66     
    64     is_gecko = ((request.META['HTTP_USER_AGENT'].lower().find("firefox")) > -1);
    67     is_gecko = ((request.META['HTTP_USER_AGENT'].lower().find("firefox")) > -1);
    65 
    68 
    66     return render_to_response("front/front_all_contents.html",
    69     return render_to_response("front/front_all_contents.html",
    67                               {'content_list':content_list, 'tag_label':tag_label, 'tag_cloud':tag_cloud,
    70                               {'content_list':content_list, 'tag_label':tag_label, 'front_tags':front_tags, 'tag_cloud':tag_cloud,
    68                                'is_gecko': is_gecko},
    71                                'is_gecko': is_gecko},
    69                               context_instance=RequestContext(request))
    72                               context_instance=RequestContext(request))
    70 
    73 
    71 
    74 
    72 @login_required
    75 @login_required