src/ldt/ldt/ldt_utils/views/content.py
changeset 786 623bc24bee49
parent 785 a6af67d18fe8
child 791 12ba862f33fa
--- a/src/ldt/ldt/ldt_utils/views/content.py	Wed Sep 19 11:25:16 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/views/content.py	Wed Sep 19 22:57:07 2012 +0900
@@ -391,9 +391,9 @@
 
     
 @login_required
-def contents_filter(request, filter): 
-    if filter and len(filter) > 0 and filter[0] == '_':
-        filter = filter[1:]
+def contents_filter(request, filter_c): 
+    if filter_c and len(filter_c) > 0 and filter_c[0] == '_':
+        filter_c = filter_c[1:]
     
     num_page = 0
     if request.GET.has_key('num_page'):
@@ -402,17 +402,17 @@
     if request.GET.has_key('tag_filter'):
         tag_filter = request.GET["tag_filter"]
     
-    # We paginate the content list, in case of filter or not
-    if filter and not tag_filter :
-        content_nb = Content.safe_objects.filter(title__icontains=filter).count()
+    # We paginate the content list, in case of filter_c or not
+    if filter_c and not tag_filter :
+        content_nb = Content.safe_objects.filter(title__icontains=filter_c).count()
         nb_ct_pages = int(math.ceil(content_nb / settings.LDT_MAX_CONTENTS_PER_PAGE)) + 1
-        content_list = Content.safe_objects.filter(title__icontains=filter)[(num_page*settings.LDT_MAX_CONTENTS_PER_PAGE):((num_page+1)*settings.LDT_MAX_CONTENTS_PER_PAGE)] #@UndefinedVariable
-    elif filter and tag_filter :
+        content_list = Content.safe_objects.filter(title__icontains=filter_c)[(num_page*settings.LDT_MAX_CONTENTS_PER_PAGE):((num_page+1)*settings.LDT_MAX_CONTENTS_PER_PAGE)] #@UndefinedVariable
+    elif filter_c and tag_filter :
         #TaggedItem.objects.get_by_model(Content.objects.all(), '"'+tag_filter+'"')
-        content_nb = TaggedItem.objects.get_by_model(Content.safe_objects.filter(title__icontains=filter), '"'+tag_filter+'"').count()
+        content_nb = TaggedItem.objects.get_by_model(Content.safe_objects.filter(title__icontains=filter_c), '"'+tag_filter+'"').count()
         nb_ct_pages = int(math.ceil(content_nb / settings.LDT_MAX_CONTENTS_PER_PAGE)) + 1
-        content_list = TaggedItem.objects.get_by_model(Content.safe_objects.filter(title__icontains=filter), '"'+tag_filter+'"')[(num_page*settings.LDT_MAX_CONTENTS_PER_PAGE):((num_page+1)*settings.LDT_MAX_CONTENTS_PER_PAGE)] #@UndefinedVariable
-    elif tag_filter and not filter:
+        content_list = TaggedItem.objects.get_by_model(Content.safe_objects.filter(title__icontains=filter_c), '"'+tag_filter+'"')[(num_page*settings.LDT_MAX_CONTENTS_PER_PAGE):((num_page+1)*settings.LDT_MAX_CONTENTS_PER_PAGE)] #@UndefinedVariable
+    elif tag_filter and not filter_c:
         content_nb = TaggedItem.objects.get_by_model(Content.safe_objects.all(), '"'+tag_filter+'"').count()
         nb_ct_pages = int(math.ceil(content_nb / settings.LDT_MAX_CONTENTS_PER_PAGE)) +1
         content_list = TaggedItem.objects.get_by_model(Content.safe_objects.all(), '"'+tag_filter+'"')[(num_page*settings.LDT_MAX_CONTENTS_PER_PAGE):((num_page+1)*settings.LDT_MAX_CONTENTS_PER_PAGE)] #@UndefinedVariable