Commit Louise-Thibaut : Correction _filter en filter dans content.py
authorgrandjoncl
Wed, 19 Sep 2012 11:25:16 +0200
changeset 785 a6af67d18fe8
parent 784 18dfa62b411a
child 786 623bc24bee49
Commit Louise-Thibaut : Correction _filter en filter dans content.py
src/ldt/ldt/ldt_utils/views/content.py
--- a/src/ldt/ldt/ldt_utils/views/content.py	Wed Sep 19 15:03:51 2012 +0900
+++ b/src/ldt/ldt/ldt_utils/views/content.py	Wed Sep 19 11:25:16 2012 +0200
@@ -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): 
+    if filter and len(filter) > 0 and filter[0] == '_':
+        filter = filter[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 or not
+    if filter and not tag_filter :
+        content_nb = Content.safe_objects.filter(title__icontains=filter).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)[(num_page*settings.LDT_MAX_CONTENTS_PER_PAGE):((num_page+1)*settings.LDT_MAX_CONTENTS_PER_PAGE)] #@UndefinedVariable
+    elif filter 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), '"'+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), '"'+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_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